当前位置: 首页>>代码示例>>C#>>正文


C# Troop.IsFriendly方法代码示例

本文整理汇总了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;
 }
开发者ID:skicean,项目名称:ZhongHuaSanGuoZhi,代码行数:49,代码来源:InfluenceKind396.cs

示例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;
 }
开发者ID:skicean,项目名称:ZhongHuaSanGuoZhi,代码行数:16,代码来源:ConditionKind1240.cs

示例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);
                    }
                }
            }
        }
开发者ID:skicean,项目名称:ZhongHuaSanGuoZhi,代码行数:23,代码来源:Challenge.cs

示例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;
 }
开发者ID:kanjianlema,项目名称:ZhongHuaSanGuoZhi,代码行数:26,代码来源:TileData.cs

示例5: CheckConditionKind

 public override bool CheckConditionKind(Troop troop)
 {
     Architecture architectureByPositionNoCheck = troop.Scenario.GetArchitectureByPositionNoCheck(troop.Position);
     return ((architectureByPositionNoCheck != null) && troop.IsFriendly(architectureByPositionNoCheck.BelongedFaction));
 }
开发者ID:skicean,项目名称:ZhongHuaSanGuoZhi,代码行数:5,代码来源:ConditionKind1420.cs

示例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);
                                        }
//.........这里部分代码省略.........
开发者ID:k45399735,项目名称:ZhongHuaSanGuoZhi,代码行数:101,代码来源:TroopEvent.cs

示例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;
        }
开发者ID:k45399735,项目名称:ZhongHuaSanGuoZhi,代码行数:66,代码来源:TroopEvent.cs

示例8: CheckConditionKind

 public override bool CheckConditionKind(Troop troop)
 {
     return ((troop.WillArchitecture != null) && troop.IsFriendly(troop.WillArchitecture.BelongedFaction));
 }
开发者ID:skicean,项目名称:ZhongHuaSanGuoZhi,代码行数:4,代码来源:ConditionKind1292.cs


注:本文中的GameObjects.Troop.IsFriendly方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。