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


C# Troop.DecreaseMorale方法代码示例

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


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

示例1: ApplyGongxin

 public void ApplyGongxin(Troop troop, int baseDecrement)
 {
     troop.DecreaseMorale(this.GenerateMoraleDecrement(baseDecrement));
     CheckTroopRout(this, troop);
     if (!this.IsFriendly(troop.BelongedFaction) && GameObject.Chance(20))
     {
         Person maxControversyAbilityPerson = this.Persons.GetMaxControversyAbilityPerson();
         Person destination = troop.Persons.GetMaxControversyAbilityPerson();
         if (((maxControversyAbilityPerson != null) && (destination != null)) && (GameObject.Random(GameObject.Square(destination.Braveness)) < GameObject.Random(0x19)))
         {
             int chance = Person.ControversyWinningChance(maxControversyAbilityPerson, destination);
             if ((maxControversyAbilityPerson.Character.ControversyChance + chance) >= 60)
             {
                 bool win = GameObject.Chance(chance);
                 if (win)
                 {
                     this.IncreaseCombativity(30);
                     troop.DecreaseCombativity(30);
                 }
                 else
                 {
                     this.DecreaseCombativity(30);
                     troop.IncreaseCombativity(30);
                 }
                 this.CurrentSourceControversyPerson = maxControversyAbilityPerson;
                 this.CurrentDestinationControversyPerson = destination;
                 if (this.OnPersonControversy != null)
                 {
                     this.OnPersonControversy(win, this, this.CurrentSourceControversyPerson, troop, this.CurrentDestinationControversyPerson);
                 }
             }
         }
     }
 }
开发者ID:skicean,项目名称:ZhongHuaSanGuoZhi,代码行数:34,代码来源:Troop.cs

示例2: GetCurrentStratagemSuccess


//.........这里部分代码省略.........
                    {
                        troop.TryToPlaySound(troop.Position, this.getSoundPath(animation.LinkedAnimation), false);
                    }
                    if (this.OnResistStratagem != null)
                    {
                        this.OnResistStratagem(this, troop, this.CurrentStratagem, true);
                    }

                    this.Persons.GetMaxIntelligencePerson().StratagemFailCount++;
                    troop.Persons.GetMaxIntelligencePerson().StratagemBeFailCount++;

                }
            }
            else if (flag)
            {
                if (((troop != null) && (this.OnStratagemSuccess != null)) && (this != troop))
                {
                    this.OnStratagemSuccess(this, troop, this.CurrentStratagem, false);
                }
                this.Persons.GetMaxIntelligencePerson().StratagemSuccessCount++;
            }
            else if ((troop != null) && (this.OnResistStratagem != null))
            {
                this.OnResistStratagem(this, troop, this.CurrentStratagem, false);
                this.Persons.GetMaxIntelligencePerson().StratagemFailCount++;
            }
            int increment = (2 + (flag ? 1 : 0)) + (this.WaitForDeepChaos ? 2 : 0);
            this.IncreaseStratagemExperience(increment, true);
            if (troop != null)
            {
                troop.IncreaseStratagemExperience(increment, false);
            }
            if (this.BelongedFaction != null)
            {
                if (flag)
                {
                    if (this.BelongedFaction.RateOfCombativityRecoveryAfterStratagemSuccess > 0f)
                    {
                        this.IncreaseCombativity(StaticMethods.GetRandomValue((int)((this.Leader.Calmness * 100) * this.BelongedFaction.RateOfCombativityRecoveryAfterStratagemSuccess), 100));
                    }
                    if (troop.BelongedFaction != this.BelongedFaction)
                    {
                        troop.army.Tiredness += this.stratagemTirednessIncrease;
                    }
                    if (this.stratagemStealTroop > 0 && troop.BelongedFaction != this.BelongedFaction)
                    {
                        int c = Math.Min(troop.Quantity, this.stratagemStealTroop);
                        troop.DecreaseQuantity(c);
                        this.IncreaseQuantity(c);
                        Troop.CheckTroopRout(this, troop);
                    }
                    if (this.stratagemStealInjury > 0 && troop.BelongedFaction != this.BelongedFaction)
                    {
                        int c = Math.Min(troop.InjuryQuantity, this.stratagemStealInjury);
                        troop.DecreaseInjuryQuantity(c);
                        this.IncreaseInjuryQuantity(c);
                    }
                    if (this.stratagemMoraleDecrease > 0 && troop.BelongedFaction != this.BelongedFaction)
                    {
                        troop.DecreaseMorale(this.stratagemMoraleDecrease);
                    }
                    if (this.stratagemCombativityDecrease > 0 && troop.BelongedFaction != this.BelongedFaction)
                    {
                        troop.DecreaseCombativity(this.stratagemCombativityDecrease);
                    }
                    if (this.stratagemTroopDecrease > 0 && troop.BelongedFaction != this.BelongedFaction)
                    {
                        troop.DecreaseQuantity(this.stratagemTroopDecrease);
                        Troop.CheckTroopRout(this, troop);
                    }
                    if (this.stratagemInjuryDecrease > 0 && troop.BelongedFaction != this.BelongedFaction)
                    {
                        troop.DecreaseInjuryQuantity(this.stratagemInjuryDecrease);
                    }
                    if (this.stratagemLoyaltyDecrease > 0 && troop.BelongedFaction != this.BelongedFaction)
                    {
                        foreach (Person p in troop.Persons)
                        {
                            p.Loyalty -= this.stratagemLoyaltyDecrease;
                            if (p.Loyalty < 0)
                            {
                                p.Loyalty = 0;
                            }
                        }
                    }
                    if (this.stratagemStealFood > 0 && troop.BelongedFaction != this.BelongedFaction)
                    {
                        int c = Math.Min(troop.Food, this.stratagemStealFood);
                        troop.Food -= c;
                        this.IncreaseFood(c);
                    }
                    return flag;
                }
                if (this.BelongedFaction.RateOfCombativityRecoveryAfterStratagemFail > 0f)
                {
                    this.IncreaseCombativity(StaticMethods.GetRandomValue((int)((this.Leader.Calmness * 100) * this.BelongedFaction.RateOfCombativityRecoveryAfterStratagemFail), 100));
                }
            }
            return flag;
        }
开发者ID:skicean,项目名称:ZhongHuaSanGuoZhi,代码行数:101,代码来源:Troop.cs


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