Skip to content

Commit

Permalink
fixes healer balance, fixes space zombie regression
Browse files Browse the repository at this point in the history
  • Loading branch information
pardeike committed Mar 3, 2022
1 parent b84361c commit 84d9f35
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 11 deletions.
Binary file modified 1.3/Assemblies/ZombieLand.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion Source/Patches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3080,7 +3080,7 @@ static void Postfix(Map __instance)
{
if (WorldRendererUtility.WorldRenderedNow) return;
if (Find.CurrentMap != __instance) return;
if (__instance.IsBlacklisted()) return;
if (__instance.Biome != SoSTools.sosOuterSpaceBiomeDef) return;

var tickManager = __instance.GetComponent<TickManager>();
if (tickManager == null) return;
Expand Down
29 changes: 21 additions & 8 deletions Source/Zombie.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ namespace ZombieLand
{
public enum NthTick
{
// never use one value more than once per tick cycle and zombie!
Every2,
Every10,
Every15,
Every30,
Every12,
Every45,
Every50,
Every60,
Every480,
Every960
Expand Down Expand Up @@ -537,17 +539,28 @@ public void CustomTick(float threatLevel)
if (threatLevel <= 0.002f && ZombieSettings.Values.zombiesDieOnZeroThreat && Rand.Chance(0.002f))
_ = TakeDamage(damageInfo);

if (isHealer && state != ZombieState.Emerging && EveryNTick(NthTick.Every15))
if (isHealer && state != ZombieState.Emerging && EveryNTick(NthTick.Every12))
{
var radius = 4 + ZombieLand.Tools.Difficulty() * 2;

var n = GenRadial.RadialDistinctThingsAround(Position, map, radius, false)
.OfType<Zombie>()
.Where(zombie => zombie.health.hediffSet.hediffs.Any()).Count();

GenRadial.RadialDistinctThingsAround(Position, map, radius, false)
.OfType<Zombie>()
.Where(zombie => zombie.health.hediffSet.hediffs.Any())
.Do(zombie =>
.Select(zombie => (zombie, zombie.health.hediffSet.hediffs))
.Where(pair => pair.hediffs.Any())
.OrderByDescending(pair => pair.hediffs.Count)
.Do(pair =>
{
zombie.health.hediffSet.Clear();
healInfo.Add(new HealerInfo(zombie));
map.debugDrawer.debugLines.Add(new DebugLine(DrawPos, zombie.DrawPos, 60, SimpleColor.Cyan));
if (healInfo.Count < 4)
{
var zombie = pair.zombie;
zombie.health.hediffSet.Clear();
healInfo.Add(new HealerInfo(zombie));
map.debugDrawer.debugLines.Add(new DebugLine(DrawPos, zombie.DrawPos, 60, SimpleColor.Cyan));
}
});
}
}
Expand Down
4 changes: 2 additions & 2 deletions Source/ZombieStateHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public static bool Roping(this JobDriver_Stumble driver, Zombie zombie)
return false;
}

if (zombie.EveryNTick(NthTick.Every60))
if (zombie.EveryNTick(NthTick.Every45))
_ = HealthUtility.FixWorstHealthCondition(zombie);

driver.destination = IntVec3.Invalid;
Expand Down Expand Up @@ -168,7 +168,7 @@ public static bool DownedOrUnconsciousness(Zombie zombie)
//
public static void ApplyFire(Zombie zombie)
{
if (zombie.isOnFire || zombie.EveryNTick(NthTick.Every60) == false)
if (zombie.isOnFire || zombie.EveryNTick(NthTick.Every50) == false)
return;

var temp = GenTemperature.GetTemperatureForCell(zombie.Position, zombie.Map);
Expand Down

0 comments on commit 84d9f35

Please sign in to comment.