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


C# Troop.IncreaseMorale方法代码示例

本文整理汇总了C#中GameObjects.Troop.IncreaseMorale方法的典型用法代码示例。如果您正苦于以下问题:C# Troop.IncreaseMorale方法的具体用法?C# Troop.IncreaseMorale怎么用?C# Troop.IncreaseMorale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GameObjects.Troop的用法示例。


在下文中一共展示了Troop.IncreaseMorale方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CheckTroopRout

 public static void CheckTroopRout(Troop sending, Troop receiving)
 {
     if (!receiving.Destroyed && ((receiving.Quantity <= 0) || (receiving.Morale <= 0)))
     {
         Faction belongedFaction = null;
         Person leader = null;
         if (receiving.BelongedFaction != null)
         {
             belongedFaction = receiving.BelongedFaction;
             leader = belongedFaction.Leader;
         }
         if (sending.OnRout != null)
         {
             sending.OnRout(sending, receiving);
         }
         if (receiving.OnRouted != null)
         {
             receiving.OnRouted(sending, receiving);
         }
         GameObjects.Animations.TileAnimation animation = sending.Scenario.GeneratorOfTileAnimation.AddTileAnimation(TileAnimationKind.被击破, receiving.Position, false);
         if (animation != null)
         {
             receiving.TryToPlaySound(receiving.Position, animation.LinkedAnimation.SoundPath, false);
         }
         if ((sending.BelongedFaction != null) && (belongedFaction != null))
         {
             sending.Scenario.ChangeDiplomaticRelation(sending.BelongedFaction.ID, receiving.BelongedFaction.ID, -10);
             sending.Scenario.ReflectDiplomaticRelations(sending.BelongedFaction.ID, receiving.BelongedFaction.ID, -10);
         }
         if (sending.BelongedFaction != null)
         {
             sending.IncreaseRoutExperience(true);
             sending.AddRoutCount();
         }
         if (belongedFaction != null)
         {
             receiving.IncreaseRoutExperience(false);
             receiving.AddRoutedCount();
             receiving.ReleaseCaptiveBeforeBeRouted();
             if (sending.BelongedFaction != null)
             {
                 sending.CheckCaptiveBeforeRout(receiving);
             }
         }
         if (sending.StartingArchitecture != null)
         {
             sending.StartingArchitecture.AddPopulationPack((int) (sending.Scenario.GetDistance(receiving.Position, sending.StartingArchitecture.ArchitectureArea) / 2.0), receiving.GetPopulation());
         }
         receiving.BeRouted();
         if (sending.Combativity < sending.Army.CombativityCeiling)
         {
             sending.IncreaseCombativity(10 + sending.RoutIncrementOfCombativity);
             if (sending.PreAction == TroopPreAction.无)
             {
                 sending.PreAction = TroopPreAction.鼓舞;
             }
         }
         if (sending.Morale < sending.Army.MoraleCeiling)
         {
             sending.IncreaseMorale(5);
             if (sending.PreAction == TroopPreAction.无)
             {
                 sending.PreAction = TroopPreAction.鼓舞;
             }
         }
     }
 }
开发者ID:skicean,项目名称:ZhongHuaSanGuoZhi,代码行数:67,代码来源:Troop.cs

示例2: CheckTroopRout


//.........这里部分代码省略.........
                    }
                    foreach (KeyValuePair<int, int> i in p.GlamourDecrease)
                    {
                        if (GameObject.Chance(i.Key))
                        {
                            receiving.Leader.BaseGlamour -= i.Value;
                        }
                    }
                    foreach (KeyValuePair<int, int> i in p.ReputationDecrease)
                    {
                        if (GameObject.Chance(i.Key))
                        {
                            receiving.Leader.BaseReputation -= i.Value;
                        }
                    }
                    foreach (KeyValuePair<int, int> i in p.LoseSkill)
                    {
                        if (GameObject.Chance(i.Key))
                        {
                            for (int si = 0; si < i.Value; ++si)
                            {
                                if (receiving.Leader.Skills.Skills.Count > 0)
                                {
                                    receiving.Leader.Skills.Skills.Remove(GameObject.Random(receiving.Leader.Skills.Skills.Count));
                                }
                            }
                        }
                    }
                    foreach (KeyValuePair<int, int> i in p.CommandIncrease)
                    {
                        if (GameObject.Chance(i.Key))
                        {
                            p.BaseCommand += i.Value;
                        }
                    }
                    foreach (KeyValuePair<int, int> i in p.StrengthIncrease)
                    {
                        if (GameObject.Chance(i.Key))
                        {
                            p.BaseStrength += i.Value;
                        }
                    }
                    foreach (KeyValuePair<int, int> i in p.IntelligenceIncrease)
                    {
                        if (GameObject.Chance(i.Key))
                        {
                            p.BaseIntelligence += i.Value;
                        }
                    }
                    foreach (KeyValuePair<int, int> i in p.PoliticsIncrease)
                    {
                        if (GameObject.Chance(i.Key))
                        {
                            p.BasePolitics += i.Value;
                        }
                    }
                    foreach (KeyValuePair<int, int> i in p.GlamourIncrease)
                    {
                        if (GameObject.Chance(i.Key))
                        {
                            p.BaseGlamour += i.Value;
                        }
                    }
                    foreach (KeyValuePair<int, int> i in p.ReputationIncrease)
                    {
                        if (GameObject.Chance(i.Key))
                        {
                            p.BaseReputation += i.Value;
                        }
                    }
                }

                foreach (Person p in receiving.persons)
                {
                    foreach (Person q in sending.persons)
                    {
                        if (p == q) continue;
                        p.AdjustRelation(q, -0.5f / Math.Max(1, sending.persons.Count - 1), -3);
                    }
                }

                receiving.BeRouted();
                if (sending.Combativity < sending.Army.CombativityCeiling)
                {
                    sending.IncreaseCombativity(10 + sending.RoutIncrementOfCombativity);
                    if (sending.PreAction == TroopPreAction.无)
                    {
                        sending.PreAction = TroopPreAction.鼓舞;
                    }
                }
                if (sending.Morale < sending.Army.MoraleCeiling)
                {
                    sending.IncreaseMorale(5);
                    if (sending.PreAction == TroopPreAction.无)
                    {
                        sending.PreAction = TroopPreAction.鼓舞;
                    }
                }
            }
        }
开发者ID:skicean,项目名称:ZhongHuaSanGuoZhi,代码行数:101,代码来源:Troop.cs


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