public ArchitectureDamage ReceiveAttackDamage(ArchitectureDamage receivedDamage)
 {
     if (receivedDamage.Damage > 0)
     {
         int maxValue = 2 + (receivedDamage.Damage / 5);
         this.DecreaseAgriculture(GameObject.Random(maxValue));
         this.DecreaseCommerce(GameObject.Random(maxValue));
         this.DecreaseTechnology(GameObject.Random(maxValue));
         this.DecreaseMorale(GameObject.Random(maxValue));
         ExtensionInterface.call("ArchitectureReceiveDamage", new Object[] { this.Scenario, this, receivedDamage });
     }
     return receivedDamage;
 }
Exemple #2
0
 internal void StartAttackArchitecture(ArchitectureDamage damage)
 {
     this.ResetDirectionArchitecture();
     this.Action = TroopAction.Attack;
     if (this.PreAction == TroopPreAction.无)
     {
         this.TryToPlaySound(this.Position, this.Army.Kind.Sounds.NormalAttackSoundPath, false);
     }
     this.AttackStarted = false;
     this.operationDone = true;
     //this.MovabilityLeft = -1;
     this.ArchitectureDamageList.Add(damage);
 }
Exemple #3
0
 private void HandleArchitectureDamage(ArchitectureDamage damage)
 {
     int num;
     if (damage.Damage >= 0)
     {
         num = damage.DestinationArchitecture.DecreaseEndurance(damage.Damage);
         damage.DestinationArchitecture.DecrementNumberList.AddNumber(num, CombatNumberKind.人数, damage.Position);
         if (damage.DestinationArchitecture.Endurance == 0)
         {
             if (this.OnBreakWall != null)
             {
                 this.OnBreakWall(damage.SourceTroop, damage.DestinationArchitecture);
             }
             GameObjects.Animations.TileAnimation animation = null;
             foreach (Point point in damage.DestinationArchitecture.ArchitectureArea.Area)
             {
                 animation = base.Scenario.GeneratorOfTileAnimation.AddTileAnimation(TileAnimationKind.被击破, point, false);
             }
             if (animation != null)
             {
                 this.TryToPlaySound(this.Position, animation.LinkedAnimation.SoundPath, false);
             }
             if (damage.DestinationArchitecture.RecentlyBreaked <= 0)
             {
                 if (damage.SourceTroop.Combativity < damage.SourceTroop.Army.CombativityCeiling)
                 {
                     damage.SourceTroop.IncreaseCombativity(10);
                     if (damage.SourceTroop.PreAction == TroopPreAction.无)
                     {
                         damage.SourceTroop.PreAction = TroopPreAction.鼓舞;
                     }
                 }
                 if (damage.SourceTroop.Morale < damage.SourceTroop.Army.MoraleCeiling)
                 {
                     damage.SourceTroop.IncreaseMorale(5);
                     if (damage.SourceTroop.PreAction == TroopPreAction.无)
                     {
                         damage.SourceTroop.PreAction = TroopPreAction.鼓舞;
                     }
                 }
             }
         }
     }
     if (damage.DominationDown > 0)
     {
         num = damage.DestinationArchitecture.DecreaseDomination(damage.DominationDown);
         damage.DestinationArchitecture.DecrementNumberList.AddNumber(num, CombatNumberKind.士气, damage.Position);
     }
     if (damage.CounterDamage > 0)
     {
         int num2 = 2;
         damage.SourceTroop.IncreaseBeAttackedExperience(num2 * 2);
         damage.SourceTroop.DecreaseQuantity(damage.CounterDamage);
         damage.SourceTroop.IncreaseInjuryQuantity(damage.CounterInjury);
         CheckTroopRout(damage.SourceTroop);
     }
 }
Exemple #4
0
 private ArchitectureDamage SendAttackDamage(Architecture architecture)
 {
     this.RecentlyFighting = 3;
     ArchitectureDamage damage = new ArchitectureDamage();
     damage.SourceTroop = this;
     damage.DestinationArchitecture = architecture;
     damage.Critical = GameObject.Chance(this.CriticalStrikeChance - (architecture.AreaCount * 3));
     damage.Position = this.OrientationPosition;
     if (architecture.Domination > 0)
     {
         int num = (int) (((((this.Offence * 10) * Parameters.ArchitectureDamageRate) * this.ArchitectureDamageRate) * this.StuntArchitectureDamageRate) / ((float) architecture.Domination));
         if (!base.Scenario.IsPlayer(this.BelongedFaction))
         {
             num = (int) (num * Parameters.AIArchitectureDamageRate);
         }
         if (damage.Critical)
         {
             this.PreAction = TroopPreAction.暴击;
             num = (int) ((num * 1.5f) * this.RateOfCriticalArchitectureDamage);
             if (architecture.Kind.HasDomination)
             {
                 damage.DominationDown = this.DominationDecrementOfCriticalStrike;
             }
             if (this.OnCriticalStrike != null)
             {
                 this.OnCriticalStrike(this, null);
             }
         }
         damage.Damage = num;
         if (damage.Damage <= 0)
         {
             damage.Damage = 1;
         }
     }
     else
     {
         damage.Damage = architecture.Endurance;
     }
     if ((architecture.BelongedFaction != null) && !this.AirOffence)
     {
         damage.CounterDamage = (int) ((((architecture.Endurance + architecture.Morale) * this.Army.Kind.ArchitectureCounterDamageRate) * 15f) / ((float) this.Defence));
         if (damage.CounterDamage > this.Quantity)
         {
             damage.CounterDamage = this.Quantity;
         }
         damage.CounterInjury = (damage.CounterDamage * this.InjuryChance) / 100;
     }
     int num2 = (2 + (damage.Critical ? 1 : 0)) + (this.CombatMethodApplied ? 1 : 0);
     this.IncreaseAttackExperience(num2 * 2);
     return damage;
 }
 public ArchitectureDamage ReceiveAttackDamage(ArchitectureDamage receivedDamage)
 {
     if (receivedDamage.Damage > 0)
     {
         int maxValue = 2 + (receivedDamage.Damage / 5);
         this.DecreaseAgriculture(GameObject.Random(maxValue));
         this.DecreaseCommerce(GameObject.Random(maxValue));
         this.DecreaseTechnology(GameObject.Random(maxValue));
         this.DecreaseMorale(GameObject.Random(maxValue));
     }
     return receivedDamage;
 }