Beispiel #1
0
 private CreditPack GetSelfStratagemCredit(Stratagem stratagem)
 {
     int creditWithPosition = 0;
     Point? position = null;
     if (stratagem.IsValid(this))
     {
         creditWithPosition = stratagem.GetCreditWithPosition(this, out position);
     }
     if (((creditWithPosition > 0) && base.Scenario.PositionIsOnFire(this.Position)) && (((this.BelongedFaction == null) && this.ViewArea.HasPoint(this.Position)) || ((this.BelongedFaction != null) && this.BelongedFaction.IsPositionKnown(this.Position))))
     {
         creditWithPosition -= 300;
     }
     CreditPack pack = new CreditPack();
     if (creditWithPosition > 0)
     {
         creditWithPosition += this.GetFoodCredit(this.Position);
         creditWithPosition += this.GetLegionCredit(this.Position);
         creditWithPosition += this.GetHostileRoutewayCredit(this.position);
         creditWithPosition += this.GetTerrainCredit(this.position);
         int positionHostileOffencingDiscredit = 0;
         Architecture architectureByPositionNoCheck = base.Scenario.GetArchitectureByPositionNoCheck(this.Position);
         if ((architectureByPositionNoCheck == null) || (architectureByPositionNoCheck.Endurance == 0))
         {
             positionHostileOffencingDiscredit = base.Scenario.GetPositionHostileOffencingDiscredit(this, this.Position);
         }
         pack.Credit = creditWithPosition - positionHostileOffencingDiscredit;
         if (position.HasValue)
         {
             pack.SelfCastPosition = position.Value;
         }
         pack.CurrentStratagem = stratagem;
     }
     else
     {
         pack.Credit = 0;
     }
     pack.Position = this.Position;
     return pack;
 }