public static int KillOverAgedHero() { int counter = 0; foreach (var hero in Hero.All.ToList <Hero>()) { if (hero != null && !hero.IsDead && hero.IsNoble) { if (hero.Age >= SettingClass.Instance.MaxAge) { KillCharacterAction.ApplyByOldAge(hero, true); counter += 1; } } } return(counter); }
private void OnDailyTickHero(Hero hero) { if (hero != Hero.MainHero && hero.IsAlive && (hero.IsNoble || hero.IsWanderer) && !hero.IsNotable && hero.Age > (float)Campaign.Current.Models.AgeModel.BecomeOldAge) { float mult = 1f; MobileParty party = hero.PartyBelongedTo; if (party != null) { if (party.Army != null) { mult *= 0.5f; } if (party.MapEvent != null) { mult *= 0.5f; } } if (hero.Clan != null && hero.Clan.Heroes.Count(h => h.IsAlive) < 3) { mult *= 0.5f; } if (MBRandom.RandomFloat < hero.ProbabilityOfDeath * mult) { ZenDzeeWorkarounds.PrepareToKillHero(hero); KillCharacterAction.ApplyByOldAge(hero, true); } } }