public override int GetCreditWithPosition(Troop source, out Point? position) { //position = 0; position = new Point(0, 0); int num = 0; if (((source.BelongedLegion == null) || source.Scenario.PositionIsOnFireNoCheck(source.Position)) || (GameObject.Random(source.BelongedLegion.Troops.Count) <= 0)) { int pureFightingForce = source.PureFightingForce; int num3 = source.TroopIntelligence + source.ChanceIncrementOfStratagem; if (num3 > 100) { num3 = 100; } num3 = GameObject.Square(num3) / 60; if (num3 > 0) { List<Point> list = new List<Point>(); foreach (Point point in source.GetStratagemArea(source.Position).Area) { if (source.Scenario.PositionIsOnFire(point)) { num += num3 / 40; list.Add(point); Troop troopByPosition = source.Scenario.GetTroopByPosition(point); if (troopByPosition == source) { num += num3 * 3; } else if (troopByPosition != null) { if (source.IsFriendly(troopByPosition.BelongedFaction)) { num += (num3 * troopByPosition.FightingForce) / pureFightingForce; } else { num -= (num3 * troopByPosition.FightingForce) / pureFightingForce; } } } } if (num > 0) { position = new Point?(source.Position); } } } return num; }
public override bool CheckConditionKind(Troop troop) { GameObjectList viewingArchitecturesByPosition = troop.Scenario.GetViewingArchitecturesByPosition(troop.Position); if (viewingArchitecturesByPosition.Count > 0) { foreach (Architecture architecture in viewingArchitecturesByPosition) { if (troop.IsFriendly(architecture.BelongedFaction)) { return true; } } return false; } return false; }
private bool ChallengeOftenShow = false; //暴击必然触发单挑,调试单挑程序用,默认为false internal void ChallgenEvent(Troop sourceTroop, Troop troop, TroopDamage damage, GameScenario gameScenario) { if ((!sourceTroop.IsFriendly(troop.BelongedFaction) && !sourceTroop.AirOffence) && (this.ChallengeOftenShow || GameObject.Chance(20))) { Person maxStrengthPerson = sourceTroop.Persons.GetMaxStrengthPerson(); Person destination = troop.Persons.GetMaxStrengthPerson(); if (((maxStrengthPerson != null) && (destination != null)) && (this.ChallengeOftenShow || (GameObject.Random(GameObject.Square(destination.Calmness)) < GameObject.Random(0x19)))) { if (maxStrengthPerson.IsCivil() || destination.IsCivil()) //文官不单挑 { return; } int chance = Person.ChanlengeWinningChance(maxStrengthPerson, destination); if (this.ChallengeOftenShow || (maxStrengthPerson.Character.ChallengeChance + chance) >= 60) { this.challengeHappen(damage, maxStrengthPerson, destination, chance, gameScenario); } } } }
public int GetPositionHostileOffencingDiscredit(Troop troop) { if (this.OffencingTroops == null) { return 0; } int num = 0; foreach (Troop troop2 in this.OffencingTroops) { if (!troop.IsFriendly(troop2.BelongedFaction)) { if (troop.BelongedFaction != null) { if (troop.BelongedFaction.IsPositionKnown(troop2.Position)) { num += troop2.GetAttackTroopDiscredit(troop); } } else if (troop.ViewArea.HasPoint(troop2.Position)) { num += troop2.GetAttackTroopDiscredit(troop); } } } return num; }
public override bool CheckConditionKind(Troop troop) { Architecture architectureByPositionNoCheck = troop.Scenario.GetArchitectureByPositionNoCheck(troop.Position); return ((architectureByPositionNoCheck != null) && troop.IsFriendly(architectureByPositionNoCheck.BelongedFaction)); }
public void ApplyEventEffects(Troop self) { if (((self != null) && !self.Destroyed) && (!this.Happened || this.Repeatable)) { Troop troopByPositionNoCheck; this.Happened = true; TroopList list = new TroopList(); if (this.SelfEffects.Count > 0) { list.Add(self); foreach (GameObjects.TroopDetail.EventEffect.EventEffect effect in this.SelfEffects) { effect.ApplyEffect(self.Leader); } } foreach (TroopEffectPerson person in this.EffectPersons) { person.Effect.ApplyEffect(person.EffectPerson); if ((person.EffectPerson.LocationTroop != null) && (list.GetGameObject(person.EffectPerson.LocationTroop.ID) == null)) { list.Add(person.EffectPerson.LocationTroop); } } List<TroopEffectArea> list2 = new List<TroopEffectArea>(); List<TroopEffectArea> list3 = new List<TroopEffectArea>(); List<TroopEffectArea> list4 = new List<TroopEffectArea>(); foreach (TroopEffectArea area in this.EffectAreas) { switch (area.Kind) { case EffectAreaKind.视野敌军: list2.Add(area); break; case EffectAreaKind.视野友军: list2.Add(area); break; case EffectAreaKind.八格敌军: list3.Add(area); break; case EffectAreaKind.八格友军: list3.Add(area); break; case EffectAreaKind.攻击范围敌军: list4.Add(area); break; case EffectAreaKind.攻击范围友军: list4.Add(area); break; } } foreach (TroopEffectArea area in list2) { foreach (Point point in self.BaseViewArea.Area) { if (self.BelongedFaction.IsPositionKnown(point)) { troopByPositionNoCheck = base.Scenario.GetTroopByPositionNoCheck(point); if (troopByPositionNoCheck != null) { switch (area.Kind) { case EffectAreaKind.视野敌军: if (!self.IsFriendly(troopByPositionNoCheck.BelongedFaction)) { area.Effect.ApplyEffect(troopByPositionNoCheck.Leader); } break; case EffectAreaKind.视野友军: if (self.IsFriendly(troopByPositionNoCheck.BelongedFaction)) { area.Effect.ApplyEffect(troopByPositionNoCheck.Leader); } break; } } } } } foreach (TroopEffectArea area in list3) { foreach (Point point in GameArea.GetArea(self.Position, 1, true).Area) { if (self.BelongedFaction.IsPositionKnown(point)) { troopByPositionNoCheck = base.Scenario.GetTroopByPositionNoCheck(point); if (troopByPositionNoCheck != null) { switch (area.Kind) { case EffectAreaKind.八格敌军: if (!self.IsFriendly(troopByPositionNoCheck.BelongedFaction)) { area.Effect.ApplyEffect(troopByPositionNoCheck.Leader); } break; case EffectAreaKind.八格友军: if (self.IsFriendly(troopByPositionNoCheck.BelongedFaction)) { area.Effect.ApplyEffect(troopByPositionNoCheck.Leader); } break; } } } } } foreach (TroopEffectArea area in list4) { //Label_0539: foreach (Point point in self.OffenceArea.Area) { if (!self.BelongedFaction.IsPositionKnown(point)) { continue; } troopByPositionNoCheck = base.Scenario.GetTroopByPositionNoCheck(point); if (troopByPositionNoCheck != null) { switch (area.Kind) { case EffectAreaKind.攻击范围敌军: if (!self.IsFriendly(troopByPositionNoCheck.BelongedFaction)) { area.Effect.ApplyEffect(troopByPositionNoCheck.Leader); } break; case EffectAreaKind.攻击范围友军: if (self.IsFriendly(troopByPositionNoCheck.BelongedFaction)) { area.Effect.ApplyEffect(troopByPositionNoCheck.Leader); } break; } } } } foreach (Troop troop in list) { Troop.CheckTroopRout(troop); } } }
public bool CheckTroop(Troop troop) { if (!this.Happened || this.Repeatable) { if (!((this.AfterHappenedEvent == null) || this.AfterHappenedEvent.Happened)) { return false; } if (!GameObject.Chance(this.HappenChance)) { return false; } if ((this.LaunchPerson == null) || troop.Persons.HasGameObject(this.LaunchPerson)) { if (!this.CheckCondition(troop)) { return false; } if (this.TargetPersons.Count <= 0) { return true; } GameArea baseViewArea = null; switch (this.CheckArea) { case EventCheckAreaKind.视野: baseViewArea = troop.BaseViewArea; break; case EventCheckAreaKind.八格: baseViewArea = GameArea.GetArea(troop.Position, 1, true); break; case EventCheckAreaKind.攻击范围: baseViewArea = troop.OffenceArea; break; } if (baseViewArea != null) { int num = 0; foreach (Point point in baseViewArea.Area) { if (troop.BelongedFaction != null) { if (troop.BelongedFaction.IsPositionKnown(point)) { Troop troopByPositionNoCheck = base.Scenario.GetTroopByPositionNoCheck(point); if (troopByPositionNoCheck != null) { foreach (PersonRelation relation in this.TargetPersons) { if (((relation.Relation == PersonRelationKind.友好) == troop.IsFriendly(troopByPositionNoCheck.BelongedFaction)) && troopByPositionNoCheck.Persons.HasGameObject(relation.SpeakingPerson)) { num++; } } } } } } return (num == this.TargetPersons.Count); } } } return false; }
public override bool CheckConditionKind(Troop troop) { return ((troop.WillArchitecture != null) && troop.IsFriendly(troop.WillArchitecture.BelongedFaction)); }