public HfAttackedSite(List <Property> properties, World world) : base(properties, world) { foreach (Property property in properties) { switch (property.Name) { case "attacker_hfid": Attacker = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break; case "defender_civ_id": DefenderCiv = world.GetEntity(Convert.ToInt32(property.Value)); break; case "site_civ_id": SiteCiv = world.GetEntity(Convert.ToInt32(property.Value)); break; case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break; } } Attacker.AddEvent(this); DefenderCiv.AddEvent(this); SiteCiv.AddEvent(this); Site.AddEvent(this); }
public HfFreed(List <Property> properties, World world) : base(properties, world) { RescuedHistoricalFigures = new List <HistoricalFigure>(); foreach (Property property in properties) { switch (property.Name) { case "freeing_civ_id": FreeingCiv = world.GetEntity(Convert.ToInt32(property.Value)); break; case "freeing_hfid": FreeingHf = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break; case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break; case "rescued_hfid": RescuedHistoricalFigures.Add(world.GetHistoricalFigure(Convert.ToInt32(property.Value))); break; case "site_civ_id": SiteCiv = world.GetEntity(Convert.ToInt32(property.Value)); break; case "holding_civ_id": HoldingCiv = world.GetEntity(Convert.ToInt32(property.Value)); break; } } foreach (var rescuedHistoricalFigure in RescuedHistoricalFigures) { rescuedHistoricalFigure.AddEvent(this); } FreeingCiv.AddEvent(this); FreeingHf.AddEvent(this); Site.AddEvent(this); SiteCiv.AddEvent(this); HoldingCiv.AddEvent(this); }
} // TODO // legends_plus.xml public CreateEntityPosition(List <Property> properties, World world) : base(properties, world) { foreach (Property property in properties) { switch (property.Name) { case "histfig": HistoricalFigure = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break; case "civ": Civ = world.GetEntity(Convert.ToInt32(property.Value)); break; case "site_civ": SiteCiv = world.GetEntity(Convert.ToInt32(property.Value)); break; case "position": Position = property.Value; break; case "reason": Reason = Convert.ToInt32(property.Value); break; } } HistoricalFigure.AddEvent(this); Civ.AddEvent(this); if (SiteCiv != Civ) { SiteCiv.AddEvent(this); } }
public HfDestroyedSite(List <Property> properties, World world) : base(properties, world) { foreach (Property property in properties) { switch (property.Name) { case "attacker_hfid": Attacker = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break; case "defender_civ_id": DefenderCiv = world.GetEntity(Convert.ToInt32(property.Value)); break; case "site_civ_id": SiteCiv = world.GetEntity(Convert.ToInt32(property.Value)); break; case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break; } } Attacker.AddEvent(this); DefenderCiv.AddEvent(this); SiteCiv.AddEvent(this); Site.AddEvent(this); OwnerPeriod lastSiteOwnerPeriod = Site.OwnerHistory.LastOrDefault(); if (lastSiteOwnerPeriod != null) { lastSiteOwnerPeriod.EndYear = Year; lastSiteOwnerPeriod.EndCause = "destroyed"; lastSiteOwnerPeriod.Ender = Attacker; } if (DefenderCiv != null) { OwnerPeriod lastDefenderCivOwnerPeriod = DefenderCiv.SiteHistory.LastOrDefault(s => s.Site == Site); if (lastDefenderCivOwnerPeriod != null) { lastDefenderCivOwnerPeriod.EndYear = Year; lastDefenderCivOwnerPeriod.EndCause = "destroyed"; lastDefenderCivOwnerPeriod.Ender = Attacker; } } OwnerPeriod lastSiteCiveOwnerPeriod = SiteCiv.SiteHistory.LastOrDefault(s => s.Site == Site); if (lastSiteCiveOwnerPeriod != null) { lastSiteCiveOwnerPeriod.EndYear = Year; lastSiteCiveOwnerPeriod.EndCause = "destroyed"; lastSiteCiveOwnerPeriod.Ender = Attacker; } }
public CreateEntityPosition(List <Property> properties, World world) : base(properties, world) { foreach (Property property in properties) { switch (property.Name) { case "histfig": HistoricalFigure = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break; case "civ": Civ = world.GetEntity(Convert.ToInt32(property.Value)); break; case "site_civ": SiteCiv = world.GetEntity(Convert.ToInt32(property.Value)); break; case "position": Position = property.Value; break; case "reason": switch (property.Value) { case "0": case "force_of_argument": Reason = ReasonForCreatingEntity.ForceOfArgument; break; case "1": case "threat_of_violence": Reason = ReasonForCreatingEntity.ThreatOfViolence; break; case "2": case "collaboration": Reason = ReasonForCreatingEntity.Collaboration; break; case "3": case "wave_of_popular_support": Reason = ReasonForCreatingEntity.WaveOfPopularSupport; break; case "4": case "as_a_matter_of_course": Reason = ReasonForCreatingEntity.AsAMatterOfCourse; break; } break; } } HistoricalFigure.AddEvent(this); Civ.AddEvent(this); if (SiteCiv != Civ) { SiteCiv.AddEvent(this); } }
public SpottedLeavingSite(List <Property> properties, World world) : base(properties, world) { foreach (Property property in properties) { switch (property.Name) { case "spotter_hfid": Spotter = world.GetHistoricalFigure(Convert.ToInt32(property.Value)); break; case "leaver_civ_id": LeaverCiv = world.GetEntity(Convert.ToInt32(property.Value)); break; case "site_civ_id": SiteCiv = world.GetEntity(Convert.ToInt32(property.Value)); break; case "site_id": Site = world.GetSite(Convert.ToInt32(property.Value)); break; } } Spotter.AddEvent(this); LeaverCiv.AddEvent(this); SiteCiv.AddEvent(this); Site.AddEvent(this); }