本文整理汇总了C#中GameObjects.Troop.IsFriendly方法的典型用法代码示例。如果您正苦于以下问题:C# Troop.IsFriendly方法的具体用法?C# Troop.IsFriendly怎么用?C# Troop.IsFriendly使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameObjects.Troop
的用法示例。
在下文中一共展示了Troop.IsFriendly方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCreditWithPosition
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;
}
示例2: CheckConditionKind
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;
}
示例3: ChallgenEvent
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);
}
}
}
}
示例4: GetPositionHostileOffencingDiscredit
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;
}
示例5: CheckConditionKind
public override bool CheckConditionKind(Troop troop)
{
Architecture architectureByPositionNoCheck = troop.Scenario.GetArchitectureByPositionNoCheck(troop.Position);
return ((architectureByPositionNoCheck != null) && troop.IsFriendly(architectureByPositionNoCheck.BelongedFaction));
}
示例6: ApplyEventEffects
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);
}
//.........这里部分代码省略.........
示例7: CheckTroop
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;
}
示例8: CheckConditionKind
public override bool CheckConditionKind(Troop troop)
{
return ((troop.WillArchitecture != null) && troop.IsFriendly(troop.WillArchitecture.BelongedFaction));
}