本文整理汇总了C#中GameObjects.TroopList类的典型用法代码示例。如果您正苦于以下问题:C# TroopList类的具体用法?C# TroopList怎么用?C# TroopList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TroopList类属于GameObjects命名空间,在下文中一共展示了TroopList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCreditWithPosition
public override int GetCreditWithPosition(Troop source, out Point? position)
{
//position = 0;
position = new Point(0, 0);
TroopList hostileTroopsInView = source.GetHostileTroopsInView();
TroopList list2 = new TroopList();
foreach (Troop troop in hostileTroopsInView)
{
if ((troop.IsInArchitecture || !troop.DaysToReachPosition(source.Position, 1)) || (troop.Army.Kind.Type == MilitaryType.水军))
{
list2.Add(troop);
}
}
foreach (Troop troop in list2)
{
hostileTroopsInView.Remove(troop);
}
if (hostileTroopsInView.Count == 0)
{
return 0;
}
List<Point> orientations = new List<Point>();
int num = 0;
foreach (Troop troop in hostileTroopsInView)
{
orientations.Add(troop.Position);
num += troop.FightingForce;
}
int num2 = 0;
int fightingForce = source.FightingForce;
int num4 = source.TroopIntelligence + source.ChanceIncrementOfStratagem;
if (num4 > 100)
{
num4 = 100;
}
num2 = (((GameObject.Square(num4) / 60) * num) / fightingForce) / 100;
if (num2 > 0)
{
GameArea area = new GameArea();
foreach (Point point in source.GetStratagemArea(source.Position).Area)
{
if (!source.Scenario.PositionIsOnFire(point) && (source.Scenario.IsPositionEmpty(point) && source.Scenario.IsFireVaild(point, false, MilitaryType.步兵)))
{
area.Area.Add(point);
}
}
if (area.Count > 0)
{
position = source.Scenario.GetClosestPosition(area, orientations);
}
else
{
num2 = 0;
}
}
return num2;
}
示例2: MainGameScreen
public MainGameScreen(MainGame game)
: base(game)
{
this.Player = new WindowsMediaPlayerClass();
this.Textures = new GameTextures();
this.mainMapLayer = new MainMapLayer();
this.architectureLayer = new ArchitectureLayer();
this.mapVeilLayer = new MapVeilLayer();
this.troopLayer = new TroopLayer();
this.selectingLayer = new SelectingLayer();
this.tileAnimationLayer = new TileAnimationLayer();
this.routewayLayer = new RoutewayLayer();
this.Plugins = new GamePlugin();
this.SelectorTroops = new TroopList();
this.scrollSpeedScale = 1f;
this.scrollSpeedScaleDefault = 1f;
this.scrollSpeedScaleSpeedy = 1.7f;
this.oldScrollWheelValue = 0;
this.EnableLaterMouseLeftDownEvent = true;
this.EnableLaterMouseLeftUpEvent = true;
this.EnableLaterMouseRightDownEvent = true;
this.EnableLaterMouseRightUpEvent = true;
this.EnableLaterMouseMoveEvent = true;
this.EnableLaterMouseScrollEvent = true;
this.frameRate = 0;
this.frameCounter = 0;
this.elapsedTime = TimeSpan.Zero;
this.UpdateCount = 0;
this.thisGame = game;
this.screenManager = new ScreenManager(this);
base.Scenario = new GameScenario(this);
this.LoadCommonData();
base.Game.Window.ClientSizeChanged += new EventHandler(this.Window_ClientSizeChanged);
base.Game.Activated += new EventHandler(this.Game_Activated);
base.Game.Deactivated += new EventHandler(this.Game_Deactivated);
base.Scenario.OnAfterLoadScenario += new GameScenario.AfterLoadScenario(this.Scenario_OnAfterLoadScenario);
base.Scenario.OnNewFactionAppear += new GameScenario.NewFactionAppear(this.Scenario_OnNewFactionAppear);
base.Scenario.Date.OnDayStarting += new GameDate.DayStartingEvent(this.Date_OnDayStarting);
base.Scenario.Date.OnDayPassed += new GameDate.DayPassedEvent(this.Date_OnDayPassed);
base.Scenario.Date.OnMonthPassed += new GameDate.MonthPassedEvent(this.Date_OnMonthPassed);
base.Scenario.Date.OnSeasonChange += new GameDate.SeasonChangeEvent(this.Date_OnSeasonChange);
base.Scenario.Date.OnYearStarting += new GameDate.YearStartingEvent(this.Date_OnYearStarting);
base.Scenario.Date.OnYearPassed += new GameDate.YearPassedEvent(this.Date_OnYearPassed);
//this.Player.add_PlayStateChange(new _WMPOCXEvents_PlayStateChangeEventHandler(this.Player_PlayStateChange));
this.Player.PlayStateChange+=(new _WMPOCXEvents_PlayStateChangeEventHandler(this.Player_PlayStateChange));
//this.ShowyoucelanInFrame(UndoneWorkKind.Frame, FrameKind.Architecture, FrameFunction.Jump, false, true, false, false, base.Scenario.CurrentPlayer.Architectures, null, "跳转", "");
}
示例3: DefensiveCampaign
private void DefensiveCampaign()
{
if ((this.HasPerson() && this.HasCampaignableMilitary()) && (this.GetAllAvailableArea(false).Count != 0))
{
TroopList hostileTroopsInView = this.GetHostileTroopsInView();
if (hostileTroopsInView.Count > 0)
{
List<Point> orientations = new List<Point>();
foreach (Troop troop in hostileTroopsInView)
{
orientations.Add(troop.Position);
}
TroopList friendlyTroopsInView = this.GetFriendlyTroopsInView();
int num = 0;
int militaryCount = this.MilitaryCount;
while ((num < militaryCount) && (this.TotalFriendlyForce < (this.TotalHostileForce * 5)))
{
Troop troop2;
num++;
int num3 = (this.TotalHostileForce * 5) - this.TotalFriendlyForce;
TroopList list4 = new TroopList();
bool isBesideWater = this.IsBesideWater;
//Label_033D:
foreach (Military military in this.Militaries.GetRandomList())
{
if ((isBesideWater || (military.Kind.Type != MilitaryType.水军)) && (((((this.Endurance < 30) || military.Kind.AirOffence) || (military.Scales >= 2)) && (military.Morale > 0x2d)) && ((this.Endurance < 30) || (military.InjuryQuantity < military.Kind.MinScale))))
{
PersonList list5;
if ((military.FollowedLeader != null) && this.Persons.HasGameObject(military.FollowedLeader))
{
list5 = new PersonList();
list5.Add(military.FollowedLeader);
military.FollowedLeader.Selected = true;
troop2 = Troop.CreateSimulateTroop(list5, military, this.Position);
list4.Add(troop2);
}
else
{
if ((((military.Leader != null) && (military.LeaderExperience >= 200)) && (((military.Leader.Strength >= 80) || (military.Leader.Command >= 80)) || military.Leader.HasLeaderValidCombatTitle)) && this.Persons.HasGameObject(military.Leader))
{
list5 = new PersonList();
list5.Add(military.Leader);
military.Leader.Selected = true;
troop2 = Troop.CreateSimulateTroop(list5, military, this.Position);
list4.Add(troop2);
//goto Label_033D;
continue;
}
foreach (Person person in this.Persons)
{
if (!person.Selected)
{
list5 = new PersonList();
list5.Add(person);
troop2 = Troop.CreateSimulateTroop(list5, military, this.Position);
list4.Add(troop2);
}
}
}
}
}
if (list4.Count <= 0)
{
break;
}
list4.IsNumber = true;
list4.PropertyName = "FightingForce";
list4.ReSort();
foreach (Troop troop in list4.GetList())
{
if (((troop.FightingForce < 0x2710) && (troop.FightingForce < (num3 / 0x19))) && (troop.Army.Scales < 10))
{
return;
}
Point? nullable = this.GetCampaignPosition(troop, orientations, troop.Army.Scales > 0);
if (!nullable.HasValue)
{
return;
}
if (troop.Army.Kind.AirOffence && (troop.Army.Scales < 2))
{
Architecture architectureByPositionNoCheck = base.Scenario.GetArchitectureByPositionNoCheck(nullable.Value);
if ((architectureByPositionNoCheck == null) || (architectureByPositionNoCheck.Endurance == 0))
{
continue;
}
}
Person leader = troop.Persons[0] as Person;
this.AddPersonToTroop(troop);
troop2 = this.CreateTroop(troop.Persons, leader, troop.Army, -1, nullable.Value);
troop2.WillArchitecture = this;
if (this.DefensiveLegion == null)
{
this.CreateDefensiveLegion();
}
this.DefensiveLegion.AddTroop(troop2);
this.PostCreateTroop(troop2, false);
this.TotalFriendlyForce += troop2.FightingForce;
break;
}
//.........这里部分代码省略.........
示例4: GetLegionHostileTroopFightingForceInView
internal int GetLegionHostileTroopFightingForceInView()
{
TroopList list = new TroopList();
int num = 0;
foreach (Troop troop in this.Troops)
{
foreach (Troop troop2 in troop.GetHostileTroopsInView())
{
if (!list.HasGameObject(troop2))
{
list.Add(troop2);
num += troop2.FightingForce;
}
}
}
return num;
}
示例5: ResetFaction
public void ResetFaction(Faction faction)
{
Faction oldFaction = this.BelongedFaction;
this.ResetAuto();
this.PlanFacilityKind = null;
this.PlanFacilityKindID = -1;
if ((faction != null) && base.Scenario.IsPlayer(faction))
{
this.AutoHiring = true;
this.AutoRewarding = true;
}
if (this.BelongedFaction != null && this.BelongedFaction != faction)
{
this.ClearFundPacks();
this.ClearRouteways();
this.ReleaseAllCaptive();
this.PurifyFactionInfluences();
if (this.BelongedSection != null)
{
this.BelongedSection.RemoveArchitecture(this);
}
this.DefensiveLegion = null;
if (this == this.BelongedFaction.Capital)
{
Person leader = this.BelongedFaction.Leader;
while (this.Persons.Count > 0)
{
Person person2 = this.Persons[0] as Person;
person2.Status = PersonStatus.NoFaction;
person2.LocationArchitecture = this;
}
//this.Persons.Clear();
while (this.MovingPersons.Count > 0)
{
Person person2 = this.MovingPersons[0] as Person;
person2.OutsideTask = OutsideTaskKind.无;
person2.TaskDays = 0;
person2.Status = PersonStatus.NoFaction;
person2.LocationArchitecture = this;
person2.TargetArchitecture = null;
}
//if ((leader.LocationTroop == null) || leader.IsCaptive)
{
TroopList list = new TroopList();
foreach (Troop troop in this.BelongedFaction.Troops)
{
list.Add(troop);
}
foreach (Troop troop in list)
{
troop.FactionDestroy();
}
if (faction != null)
{
faction.CheckLeaderDeath(leader);
}
this.BelongedFaction.Destroy();
}
this.BelongedFaction.Capital = null;
}
else
{
while (this.Persons.Count > 0)
{
if ((this.Persons[0] as Person).LocationArchitecture != null)
{
(this.Persons[0] as Person).MoveToArchitecture(this.BelongedFaction.Capital);
}
}
while (this.MovingPersons.Count > 0)
{
if ((this.MovingPersons[0] as Person).LocationArchitecture != null)
{
(this.MovingPersons[0] as Person).MoveToArchitecture(this.BelongedFaction.Capital);
}
}
}
if (this.BelongedFaction != null)
{
this.BelongedFaction.RemoveArchitectureMilitaries(this);
this.BelongedFaction.RemoveArchitectureKnownData(this);
this.BelongedFaction.RemoveArchitecture(this);
}
if (faction != null)
{
faction.AddArchitecture(this);
this.ApplyFactionInfluences();
faction.AddArchitectureMilitaries(this);
}
else
{
this.BelongedFaction = null;
}
}
else if (faction != null)
//.........这里部分代码省略.........
示例6: GetFriendlyTroopsInView
public TroopList GetFriendlyTroopsInView()
{
GameArea longViewArea = this.LongViewArea;
TroopList list = new TroopList();
foreach (Point point in longViewArea.Area)
{
Troop troopByPosition = base.Scenario.GetTroopByPosition(point);
if ((troopByPosition != null) && troopByPosition.IsFriendly(this.BelongedFaction))
{
list.Add(troopByPosition);
}
}
return list;
}
示例7: BuildTroopForTransfer
private Troop BuildTroopForTransfer(Military military, Architecture destination, LinkKind linkkind)
{
if (linkkind == LinkKind.None)
{
return null;
}
if (!this.isArmyNavigableTo(linkkind, military))
{
return null;
}
if (this.Persons.Count == 0) return null;
TroopList list = new TroopList();
this.Persons.ClearSelected();
if ((military.Scales > 5) && (military.Morale >= 80) && (military.Combativity >= 80) && (military.InjuryQuantity < military.Kind.MinScale) && !military.IsFewScaleNeedRetreat)
{
PersonList list2;
Military military2 = military;
if ((military2.FollowedLeader != null) && this.Persons.HasGameObject(military2.FollowedLeader) && military2.FollowedLeader.WaitForFeiZi == null && military2.FollowedLeader.LocationTroop == null)
{
list2 = new PersonList();
list2.Add(military2.FollowedLeader);
military2.FollowedLeader.Selected = true;
Point? nullable = this.GetRandomStartingPosition(military2);
if (!nullable.HasValue)
{
return null;
}
Troop troop = this.CreateTroop(list2, military2.FollowedLeader, military2, -1, nullable.Value);
troop.WillArchitecture = destination;
Legion legion = this.BelongedFaction.GetLegion(destination);
if (legion == null)
{
legion = this.CreateOffensiveLegion(destination);
}
legion.AddTroop(troop);
return troop;
}
if ((((military2.Leader != null) && (military2.LeaderExperience >= 10)) && (((military2.Leader.Strength >= 80) || (military2.Leader.Command >= 80)) || military2.Leader.HasLeaderValidTitle))
&& this.Persons.HasGameObject(military2.Leader) && military2.Leader.WaitForFeiZi == null && military2.Leader.LocationTroop == null)
{
list2 = new PersonList();
list2.Add(military2.Leader);
military2.Leader.Selected = true;
Point? nullable = this.GetRandomStartingPosition(military2);
if (!nullable.HasValue)
{
return null;
}
Troop troop = this.CreateTroop(list2, military2.Leader, military2, -1, nullable.Value);
troop.WillArchitecture = destination;
Legion legion = this.BelongedFaction.GetLegion(destination);
if (legion == null)
{
legion = this.CreateOffensiveLegion(destination);
}
legion.AddTroop(troop);
return troop;
}
GameObjectList sortedList = this.Persons.GetList() as GameObjectList;
sortedList.PropertyName = "FightingForce";
sortedList.IsNumber = true;
sortedList.SmallToBig = true;
sortedList.ReSort();
foreach (Person person in sortedList)
{
if (!person.Selected && person.WaitForFeiZi == null && person.LocationTroop == null)
{
list2 = new PersonList();
list2.Add(person);
person.Selected = true;
Point? nullable = this.GetRandomStartingPosition(military2);
if (!nullable.HasValue)
{
break;
}
Troop troop = this.CreateTroop(list2, person, military2, -1, nullable.Value);
troop.WillArchitecture = destination;
Legion legion = this.BelongedFaction.GetLegion(destination);
if (legion == null)
{
legion = this.CreateOffensiveLegion(destination);
}
legion.AddTroop(troop);
return troop;
}
}
}
return null;
}
示例8: AISelectPersonIntoTroop
private TroopList AISelectPersonIntoTroop(Architecture from, Military military)
{
TroopList result = new TroopList();
if ((military.FollowedLeader != null) && from.Persons.HasGameObject(military.FollowedLeader) && military.FollowedLeader.LocationTroop == null)
{
result.Add(Troop.CreateSimulateTroop(this.AISelectPersonIntoTroop_inner(military.FollowedLeader, from.Persons, true), military, from.Position));
}
else if ((((military.Leader != null) && (military.LeaderExperience >= 10)) && (((military.Leader.Strength >= 80) || (military.Leader.Command >= 80)) || military.Leader.HasLeaderValidCombatTitle))
&& from.Persons.HasGameObject(military.Leader) && military.Leader.LocationTroop == null)
{
result.Add(Troop.CreateSimulateTroop(this.AISelectPersonIntoTroop_inner(military.Leader, from.Persons, true), military, from.Position));
}
else
{
foreach (Person person in from.Persons)
{
if (!person.Selected)
{
if ((this.BelongedFaction.AvailableMilitaryKinds.GetMilitaryKindList().GameObjects.Contains(military.Kind) && !military.Kind.Unique) ||
person.FightingForce >= Parameters.AIUniqueTroopFightingForceThreshold || this.Endurance < 30)
{
result.Add(Troop.CreateSimulateTroop(this.AISelectPersonIntoTroop_inner(person, from.Persons, false), military, from.Position));
}
}
}
}
return result;
}
示例9: GetAllOtherTroopsInView
public TroopList GetAllOtherTroopsInView()
{
TroopList list = new TroopList();
foreach (Point point in this.ViewArea.Area)
{
Troop troopByPosition = base.Scenario.GetTroopByPosition(point);
if ((troopByPosition != null) && (troopByPosition != this))
{
list.Add(troopByPosition);
}
}
return list;
}
示例10: GetAllOffenceAreaTroops
private TroopList GetAllOffenceAreaTroops(Point position)
{
TroopList list = new TroopList();
foreach (Point point in this.GetOffenceArea(position).Area)
{
if ((this.BelongedFaction == null) || this.BelongedFaction.IsPositionKnown(point))
{
Troop troopByPosition = base.Scenario.GetTroopByPosition(point);
if (troopByPosition != null)
{
list.Add(troopByPosition);
}
}
}
return list;
}
示例11: DayEvent
//.........这里部分代码省略.........
this.IncrementNumberList.AddNumber(number, CombatNumberKind.人数, this.Position);
this.ShowNumber = true;
}
}
if (this.ChaosDayLeft > 0)
{
this.ChaosDayLeft--;
if ((this.ChaosDayLeft == 0) || this.StuntRecoverFromChaos)
{
this.SetRecoverFromChaos();
}
}
if (base.Scenario.FireTable.HasPosition(this.Position))
{
this.SetOnFire(Parameters.FireDamageScale * base.Scenario.GetTerrainDetailByPositionNoCheck(this.Position).FireDamageRate);
}
if (this.CutRoutewayDays > 0)
{
this.CutRoutewayDays--;
if (this.CutRoutewayDays == 0)
{
this.CutPositionRouteway();
}
else if (this.CheckPositionRouteway())
{
this.Controllable = false;
this.Operated = true;
}
else
{
this.CutRoutewayDays = 0;
if (this.OnEndCutRouteway != null)
{
this.OnEndCutRouteway(this, false);
}
}
}
if (this.Food >= this.FoodCostPerDay)
{
this.Food -= this.FoodCostPerDay;
this.RefillFoodByArchitecture();
this.RefillFoodByRouteway();
}
else
{
this.RefillFoodByArchitecture();
this.RefillFoodByRouteway();
if (this.Food < this.FoodCostPerDay)
{
this.Food = 0;
if (this.RecentlyFighting > 0)
{
this.DecreaseCombativity(10);
this.DecreaseMorale((int) (10f * this.MoraleChangeRateOnOutOfFood));
}
else
{
this.DecreaseCombativity(5);
this.DecreaseMorale(5);
}
CheckTroopRout(this);
}
else
{
this.Food -= this.FoodCostPerDay;
}
}
if (this.BelongedFaction != null)
{
foreach (TroopEvent event2 in base.Scenario.TroopEvents.GetRandomList())
{
if (event2.CheckTroop(this))
{
event2.ApplyEventDialogs(this);
TroopList list = null;
if (base.Scenario.TroopEventsToApply.TryGetValue(event2, out list))
{
list.Add(this);
}
else
{
list = new TroopList();
list.Add(this);
base.Scenario.TroopEventsToApply.Add(event2, list);
}
}
}
}
if ((this.CurrentStunt != null) && (this.StuntDayLeft > 0))
{
this.StuntDayLeft--;
if (this.StuntDayLeft == 0)
{
this.CurrentStunt.Purify(this);
this.CurrentStunt = null;
this.RefreshAllData();
}
}
this.ResetDayInfluence();
}
示例12: BeRouted
public void BeRouted()
{
if (this.BelongedFaction == null)
{
this.Destroy();
base.Scenario.Militaries.Remove(this.Army);
base.Scenario.Troops.RemoveTroop(this);
if ((this.StartingArchitecture != null) && (this.StartingArchitecture.RobberTroop == this))
{
this.StartingArchitecture.RobberTroop = null;
}
if (this.OrientationTroop != null)
{
this.OrientationTroop.OperationDone = !this.OrientationTroop.CanAttackAfterRout;
}
}
else
{
bool flag = false;
if ((this.BelongedFaction.Leader == this.Leader) && (this.BelongedFaction.ArchitectureCount == 0))
{
flag = true;
}
foreach (Person person in this.Persons)
{
if ((this.StartingArchitecture == null) || (this.BelongedFaction != this.StartingArchitecture.BelongedFaction))
{
if (this.BelongedFaction.Capital != null)
{
this.StartingArchitecture = this.BelongedFaction.Capital;
}
else
{
this.BelongedFaction.RemovePerson(person);
}
}
if (this.StartingArchitecture != null)
{
person.MoveToArchitecture(this.StartingArchitecture);
}
else if (base.Scenario.Architectures.Count > 0)
{
person.MoveToArchitecture(base.Scenario.Architectures[0] as Architecture);
}
person.LocationTroop = null;
}
this.Destroy();
this.BelongedLegion.RemoveTroop(this);
if (this.Army.ShelledMilitary == null)
{
this.BelongedFaction.RemoveMilitary(this.Army);
}
else
{
this.BelongedFaction.RemoveMilitary(this.Army.ShelledMilitary);
base.Scenario.Militaries.Remove(this.Army.ShelledMilitary);
}
base.Scenario.Militaries.Remove(this.Army);
if (flag)
{
TroopList list = new TroopList();
foreach (Troop troop in this.BelongedFaction.Troops)
{
if (troop != this)
{
list.Add(troop);
}
}
foreach (Troop troop in list)
{
troop.FactionDestroy();
}
this.BelongedFaction.Destroy();
}
else
{
this.BelongedFaction.RemoveTroop(this);
}
base.Scenario.Troops.RemoveTroop(this);
if ((this.OrientationTroop != null) && !this.ProhibitAllAction)
{
this.OrientationTroop.OperationDone = !this.OrientationTroop.CanAttackAfterRout && !this.OrientationTroop.StuntCanAttackAfterRout;
if (!(this.OrientationTroop.OperationDone || this.OrientationTroop.QueueEnded))
{
this.OrientationTroop.AttackedTroopList.Clear();
}
}
}
}
示例13: DayEvent
//.........这里部分代码省略.........
if (base.Scenario.FireTable.HasPosition(this.Position))
{
this.SetOnFire(Parameters.FireDamageScale * base.Scenario.GetTerrainDetailByPositionNoCheck(this.Position).FireDamageRate);
}
if (this.CutRoutewayDays > 0)
{
this.CutRoutewayDays--;
if (this.CutRoutewayDays == 0)
{
this.CutPositionRouteway();
}
else if (this.CheckPositionRouteway())
{
this.Controllable = false;
this.Operated = true;
}
else
{
this.CutRoutewayDays = 0;
if (this.OnEndCutRouteway != null)
{
this.OnEndCutRouteway(this, false);
}
}
}
if (this.Food >= this.FoodCostPerDay)
{
this.Food -= this.FoodCostPerDay;
this.RefillFood();
}
else
{
this.RefillFood();
if (this.Food < this.FoodCostPerDay)
{
this.Food = 0;
if (this.RecentlyFighting > 0)
{
this.DecreaseCombativity(10);
this.DecreaseMorale((int)(10f * this.MoraleChangeRateOnOutOfFood));
}
else
{
this.DecreaseCombativity(5);
this.DecreaseMorale(5);
}
CheckTroopRout(this);
}
else
{
this.Food -= this.FoodCostPerDay;
}
}
if (this.BelongedFaction != null)
{
foreach (TroopEvent event2 in base.Scenario.TroopEvents.GetList())
{
if (event2.CheckTroop(this))
{
TroopList list = null;
if (base.Scenario.TroopEventsToApply.TryGetValue(event2, out list))
{
list.Add(this);
}
else
{
list = new TroopList();
list.Add(this);
base.Scenario.TroopEventsToApply.Add(event2, list);
}
event2.ApplyEventDialogs(this);
}
}
}
if ((this.CurrentStunt != null) && (this.StuntDayLeft > 0))
{
this.StuntDayLeft--;
if (this.StuntDayLeft == 0)
{
this.CurrentStunt.Purify(this);
this.CurrentStunt = null;
this.RefreshAllData();
}
}
if (base.Scenario.IsPlayer(this.BelongedFaction) && this.TargetTroop == null && this.TargetArchitecture == null
&& this.Position.Equals(this.Destination)
&& this.Status == TroopStatus.一般 && this.WillArchitecture == this.StartingArchitecture
&& !this.HasHostileTroopInView() && !this.HasHostileArchitectureInView()
&& this.mingling != "移动" && this.mingling != "待命")
{
this.minglingweizhi = this.Destination = base.Scenario.GetClosestPoint(this.StartingArchitecture.ArchitectureArea, this.Position);
this.mingling = "入城";
this.TargetArchitecture = this.StartingArchitecture;
}
this.ResetDayInfluence();
}
示例14: BeRouted
public void BeRouted()
{
if (this.BelongedFaction == null)
{
this.Destroy(true, true);
if (this.StartingArchitecture != null && this.StartingArchitecture.RobberTroop == this) //盗贼队
{
this.StartingArchitecture.RobberTroop = null;
this.StartingArchitecture.RobberTroopID = -1;
}
if (this.OrientationTroop != null)
{
this.OrientationTroop.OperationDone = !this.OrientationTroop.CanAttackAfterRout;
}
}
else
{
if (this.IsTransport && this.WillArchitecture != null)
{
this.WillArchitecture.SuspendTroopTransfer = 0;
}
bool flag = false;
if ((this.BelongedFaction.Leader == this.Leader) && (this.BelongedFaction.ArchitectureCount == 0))
{
//flag = true;
}
Faction f = this.BelongedFaction;
this.Destroy(true, true);
foreach (Person p in this.persons)
{
foreach (Person q in this.persons)
{
if (p == q) continue;
p.AdjustRelation(q, -0.5f / (this.persons.Count - 1), -3);
}
}
foreach (Person person in this.persons)
{
Point from = this.Position;
if ((this.StartingArchitecture == null) || (f != this.StartingArchitecture.BelongedFaction))
{
if (f.Capital != null)
{
this.StartingArchitecture = f.Capital;
}
}
if (this.StartingArchitecture != null)
{
person.LocationArchitecture = this.StartingArchitecture;
person.MoveToArchitecture(this.StartingArchitecture, from);
}
person.LocationTroop = null;
}
this.persons.Clear();
if (flag)
{
TroopList list = new TroopList();
foreach (Troop troop in this.BelongedFaction.Troops)
{
if (troop != this)
{
list.Add(troop);
}
}
foreach (Troop troop in list)
{
troop.FactionDestroy();
}
this.BelongedFaction.Destroy();
}
if ((this.OrientationTroop != null) && !this.ProhibitAllAction)
{
this.OrientationTroop.OperationDone = !this.OrientationTroop.CanAttackAfterRout && !this.OrientationTroop.StuntCanAttackAfterRout;
if (!(this.OrientationTroop.OperationDone || this.OrientationTroop.QueueEnded))
{
this.OrientationTroop.AttackedTroopList.Clear();
}
}
}
ExtensionInterface.call("BeRouted", new Object[] { this.Scenario, this });
}
示例15: ResetFaction
public void ResetFaction(Faction faction)
{
this.ResetAuto();
if ((faction != null) && base.Scenario.IsPlayer(faction))
{
this.AutoHiring = true;
this.AutoRewarding = true;
}
if (this.BelongedFaction != null)
{
this.ClearFundPacks();
this.ClearRouteways();
this.ReleaseAllCaptive();
this.BelongedSection.RemoveArchitecture(this);
this.DefensiveLegion = null;
if (this == this.BelongedFaction.Capital)
{
Person leader = this.BelongedFaction.Leader;
foreach (Person person2 in this.Persons)
{
this.BelongedFaction.RemovePerson(person2);
this.AddNoFactionPerson(person2);
}
this.Persons.Clear();
foreach (Person person2 in this.MovingPersons)
{
person2.OutsideTask = OutsideTaskKind.无;
person2.TaskDays = 0;
if (person2.BelongedFaction != null)
{
person2.BelongedFaction.RemovePerson(person2);
}
}
this.MovingPersons.Clear();
if ((leader.LocationTroop == null) || leader.IsCaptive)
{
TroopList list = new TroopList();
foreach (Troop troop in this.BelongedFaction.Troops)
{
list.Add(troop);
}
foreach (Troop troop in list)
{
troop.FactionDestroy();
}
this.BelongedFaction.Destroy();
if (faction != null)
{
faction.CheckLeaderDeath(leader);
}
}
this.BelongedFaction.Capital = null;
}
else
{
PersonList list2 = new PersonList();
foreach (Person person2 in this.Persons)
{
person2.MoveToArchitecture(this.BelongedFaction.Capital);
list2.Add(person2);
}
foreach (Person person2 in list2)
{
this.RemovePerson(person2);
}
foreach (Person person2 in this.MovingPersons)
{
person2.MoveToArchitecture(this.BelongedFaction.Capital);
}
this.MovingPersons.Clear();
}
if (this.BelongedFaction != null)
{
this.BelongedFaction.RemoveArchitectureMilitaries(this);
this.BelongedFaction.RemoveArchitectureKnownData(this);
this.BelongedFaction.RemoveArchitecture(this);
}
if (faction != null)
{
faction.AddArchitecture(this);
faction.AddArchitectureMilitaries(this);
faction.AddArchitecturePersons(this);
}
else
{
this.BelongedFaction = null;
}
}
else if (faction != null)
{
faction.AddArchitecture(this);
faction.AddArchitectureMilitaries(this);
}
if (faction != null)
{
this.jianzhuqizi.qizidezi.Text = faction.ToString().Substring(0, 1);
}
//.........这里部分代码省略.........