Exemplo n.º 1
0
        public static Lord MakeNewLord(Faction faction, LordJob lordJob, Map map, IEnumerable <Pawn> startingPawns = null)
        {
            if (map == null)
            {
                Log.Warning("Tried to create a lord with null map.");
                return(null);
            }
            Lord lord = new Lord();

            lord.loadID  = Find.UniqueIDsManager.GetNextLordID();
            lord.faction = faction;
            map.lordManager.AddLord(lord);
            lord.SetJob(lordJob);
            lord.GotoToil(lord.Graph.StartingToil);
            if (startingPawns != null)
            {
                foreach (Pawn startingPawn in startingPawns)
                {
                    lord.AddPawn(startingPawn);
                }
                return(lord);
            }
            return(lord);
        }
Exemplo n.º 2
0
        public void LogLords()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendLine("======= Lords =======");
            stringBuilder.AppendLine("Count: " + lords.Count);
            for (int i = 0; i < lords.Count; i++)
            {
                Lord lord = lords[i];
                stringBuilder.AppendLine();
                stringBuilder.Append("#" + (i + 1) + ": ");
                if (lord.LordJob == null)
                {
                    stringBuilder.AppendLine("no-job");
                }
                else
                {
                    stringBuilder.AppendLine(lord.LordJob.GetType().Name);
                }
                stringBuilder.Append("Current toil: ");
                if (lord.CurLordToil == null)
                {
                    stringBuilder.AppendLine("null");
                }
                else
                {
                    stringBuilder.AppendLine(lord.CurLordToil.GetType().Name);
                }
                stringBuilder.AppendLine("Members (count: " + lord.ownedPawns.Count + "):");
                for (int j = 0; j < lord.ownedPawns.Count; j++)
                {
                    stringBuilder.AppendLine("  " + lord.ownedPawns[j].LabelShort + " (" + lord.ownedPawns[j].Faction + ")");
                }
            }
            Log.Message(stringBuilder.ToString());
        }
 public override bool ActivateOn(Lord lord, TriggerSignal signal)
 {
     if (signal.type == TriggerSignalType.Tick && Find.TickManager.TicksGame % 197 == 0)
     {
         for (int i = 0; i < lord.ownedPawns.Count; i++)
         {
             Pawn pawn = lord.ownedPawns[i];
             if (pawn.Spawned && !pawn.Dead && !pawn.Downed)
             {
                 Hediff firstHediffOfDef = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.Heatstroke, false);
                 if (firstHediffOfDef != null && firstHediffOfDef.Severity > this.temperatureHediffThreshold)
                 {
                     return(true);
                 }
                 Hediff firstHediffOfDef2 = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.Hypothermia, false);
                 if (firstHediffOfDef2 != null && firstHediffOfDef2.Severity > this.temperatureHediffThreshold)
                 {
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
Exemplo n.º 4
0
 public void RemoveLord(Lord oldLord)
 {
     this.lords.Remove(oldLord);
     oldLord.Cleanup();
 }
Exemplo n.º 5
0
 public void AddLord(Lord newLord)
 {
     this.lords.Add(newLord);
     newLord.lordManager = this;
 }
Exemplo n.º 6
0
 public override bool ActivateOn(Lord lord, TriggerSignal signal)
 {
     return(signal.type == TriggerSignalType.Memo && signal.memo == this.memo);
 }
Exemplo n.º 7
0
 public override bool ActivateOn(Lord lord, TriggerSignal signal)
 {
     return(signal.type == TriggerSignalType.PawnLost && (signal.condition == PawnLostCondition.MadePrisoner || signal.condition == PawnLostCondition.IncappedOrKilled));
 }
 public override bool ActivateOn(Lord lord, TriggerSignal signal)
 {
     return(signal.type == TriggerSignalType.FactionRelationsChanged && (signal.previousRelationKind == FactionRelationKind.Hostile && lord.faction != null) && !lord.faction.HostileTo(Faction.OfPlayer));
 }
Exemplo n.º 9
0
 public override bool ActivateOn(Lord lord, TriggerSignal signal)
 {
     return(signal.type == TriggerSignalType.PawnLost);
 }
Exemplo n.º 10
0
 public override bool ActivateOn(Lord lord, TriggerSignal signal)
 {
     return(Trigger_PawnHarmed.SignalIsHarm(signal) && (!this.requireInstigatorWithFaction || (signal.dinfo.Instigator != null && signal.dinfo.Instigator.Faction != null)) && Rand.Value < this.chance);
 }
 public override bool ActivateOn(Lord lord, TriggerSignal signal)
 {
     return(signal.type == TriggerSignalType.PawnLost && (float)lord.numPawnsLostViolently >= (float)lord.numPawnsEverGained * this.fraction);
 }
Exemplo n.º 12
0
 public void RemoveLord(Lord oldLord)
 {
     lords.Remove(oldLord);
     Find.SignalManager.DeregisterReceiver(oldLord);
     oldLord.Cleanup();
 }
Exemplo n.º 13
0
 public void AddLord(Lord newLord)
 {
     lords.Add(newLord);
     newLord.lordManager = this;
     Find.SignalManager.RegisterReceiver(newLord);
 }
Exemplo n.º 14
0
 public override bool ActivateOn(Lord lord, TriggerSignal signal)
 {
     return(signal.type == TriggerSignalType.Tick && Find.TickManager.TicksGame % this.interval == 0 && Rand.Value < this.chancePerInterval);
 }
 public override bool ActivateOn(Lord lord, TriggerSignal signal)
 {
     return(signal.type == TriggerSignalType.BuildingDamaged && signal.dinfo.Def.externalViolence && signal.thing.def.category == ThingCategory.Building && signal.dinfo.Instigator != null && signal.dinfo.Instigator.Faction == Faction.OfPlayer && signal.thing.Faction != Faction.OfPlayer && Rand.Value < this.chance);
 }
Exemplo n.º 16
0
 public abstract bool ActivateOn(Lord lord, TriggerSignal signal);
Exemplo n.º 17
0
 public override bool ActivateOn(Lord lord, TriggerSignal signal)
 {
     return(signal.type == TriggerSignalType.FactionRelationsChanged && (lord.faction == null || !lord.faction.HostileTo(Faction.OfPlayer)));
 }
Exemplo n.º 18
0
 public abstract bool AllowActivation(Lord lord, TriggerSignal signal);
 public override bool ActivateOn(Lord lord, TriggerSignal signal)
 {
     return(signal.type == TriggerSignalType.Tick && (this.thing.DestroyedOrNull() || (float)this.thing.HitPoints < (1f - this.damageFraction) * (float)this.thing.MaxHitPoints));
 }
 public override bool ActivateOn(Lord lord, TriggerSignal signal)
 {
     return(signal.type == this.signalType && Rand.Value < this.chance);
 }
Exemplo n.º 21
0
 public override bool ActivateOn(Lord lord, TriggerSignal signal)
 {
     return(signal.type == TriggerSignalType.PawnLost && signal.condition == PawnLostCondition.IncappedOrKilled && signal.Pawn.Dead);
 }
Exemplo n.º 22
0
 public override bool ActivateOn(Lord lord, TriggerSignal signal)
 {
     return(condition(signal));
 }
Exemplo n.º 23
0
		public override bool ActivateOn(Lord lord, TriggerSignal signal)
		{
			return signal.type == TriggerSignalType.PawnLost && lord.numPawnsLostViolently >= this.count;
		}
Exemplo n.º 24
0
 public override bool ActivateOn(Lord lord, TriggerSignal signal)
 {
     return(signal.type == TriggerSignalType.Tick && Find.TickManager.TicksGame % this.checkEveryTicks == 0 && this.condition());
 }
 public override bool ActivateOn(Lord lord, TriggerSignal signal)
 {
     return(base.ActivateOn(lord, signal) && Find.TickManager.TicksGame - lord.lastPawnHarmTick >= 300);
 }