本文整理汇总了C#中World.ContainsRemark方法的典型用法代码示例。如果您正苦于以下问题:C# World.ContainsRemark方法的具体用法?C# World.ContainsRemark怎么用?C# World.ContainsRemark使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类World
的用法示例。
在下文中一共展示了World.ContainsRemark方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PassengersAsync
public override async Task<PassengerList> PassengersAsync(World origin, World destination, Dice random, bool advancedCharacters)
{
var baseDM = 0;
var lowDM = 1;
var basicDM = 0;
var middleDM = 0;
var highDM = -4;
if (origin.PopulationCode.Value <= 1)
baseDM += -4;
else if (origin.PopulationCode.Value == 6 || origin.PopulationCode.Value == 7)
baseDM += 1;
else if (origin.PopulationCode.Value >= 8)
baseDM += 3;
switch (origin.StarportCode.ToString())
{
case "A": baseDM += 2; break;
case "B": baseDM += 1; break;
case "E": baseDM += -1; break;
case "X": baseDM += -3; break;
}
if (origin.ContainsRemark("A")) baseDM += 1;
if (origin.ContainsRemark("R")) baseDM += -4;
var result = new PassengerList();
result.LowPassengers = random.D(PassengerTraffic(baseDM + lowDM, random));
result.BasicPassengers = random.D(PassengerTraffic(baseDM + basicDM, random));
result.MiddlePassengers = random.D(PassengerTraffic(baseDM + middleDM, random));
result.HighPassengers = random.D(PassengerTraffic(baseDM + highDM, random));
for (var i = 0; i < result.HighPassengers; i++)
result.Passengers.Add(await PassengerDetailAsync(random, "High", advancedCharacters).ConfigureAwait(false));
for (var i = 0; i < result.MiddlePassengers; i++)
result.Passengers.Add(await PassengerDetailAsync(random, "Middle", advancedCharacters).ConfigureAwait(false));
for (var i = 0; i < result.BasicPassengers; i++)
result.Passengers.Add(await PassengerDetailAsync(random, "Basic", advancedCharacters).ConfigureAwait(false));
for (var i = 0; i < result.LowPassengers; i++)
result.Passengers.Add(await PassengerDetailAsync(random, "Low", advancedCharacters).ConfigureAwait(false));
return result;
}
示例2: PurchaseDM
int PurchaseDM(World world, TradeGood good)
{
int purchase = int.MinValue;
int sale = int.MinValue;
foreach (var item in good.PurchaseDMs)
if (world.ContainsRemark(item.Tag))
purchase = Math.Max(purchase, item.Bonus);
foreach (var item in good.SaleDMs)
if (world.ContainsRemark(item.Tag))
sale = Math.Max(sale, item.Bonus);
if (purchase == int.MinValue)
purchase = 0;
if (sale == int.MinValue)
sale = 0;
return purchase - sale;
}
示例3: BuildTradeGoodsList
public TradeGoodsList BuildTradeGoodsList(World origin, bool advancedMode, bool illegalGoods, int brokerScore, Dice random)
{
IReadOnlyList<TradeGood> goods;
if (!illegalGoods)
goods = m_LegalTradeGoods;
else
goods = m_TradeGoods;
var result = new TradeGoodsList();
List<TradeOffer> availableLots = new List<TradeOffer>();
var randomGoods = new List<TradeGood>();
/*
* Goods with *: Always available
* Good with no mark: Only 1 chance
* Other goods: 5 chances plus 20 chances per matching remark
*/
foreach (var good in goods)
{
if (good.Availability == "*")
{
AddTradeGood(origin, random, availableLots, good, advancedMode, brokerScore);
}
else if (good.Availability == "") //extremely rare
{
randomGoods.Add(good);
}
else
{
for (var i = 0; i < 1 + (5 * good.AvailabilityList.Count(a => origin.ContainsRemark(a))); i++)
randomGoods.Add(good);
}
}
for (var i = 0; i < 6; i++)
{
var good = random.Choose(randomGoods);
AddTradeGood(origin, random, availableLots, good, advancedMode, brokerScore);
randomGoods = randomGoods.Where(g => g != good).ToList();
}
List<TradeBid> requests = new List<TradeBid>();
if (!advancedMode)
foreach (var good in goods)
{
if (good.BasePrice == 0) //special case
{
foreach (var detail in good.Details)
foreach (var name in detail.NameList)
{
var bid = new TradeBid()
{
Type = good.Name,
Subtype = name,
BasePrice = detail.Price * 1000,
SaleDM = SaleDM(origin, good),
};
//TODO: Auto-bump the price so that the merchant isn't buying from the PCs at a higher price than he would sell to them
int roll;
bid.PriceModifier = SalePriceModifier(random, bid.SaleDM, brokerScore, out roll);
bid.Roll = roll;
requests.Add(bid);
}
}
else
{
var bid = new TradeBid()
{
Type = good.Name,
Subtype = null,
BasePrice = good.BasePrice * 1000,
SaleDM = SaleDM(origin, good),
};
//TODO: Auto-bump the price so that the merchant isn't buying from the PCs at a higher price than he would sell to them
int roll;
bid.PriceModifier = SalePriceModifier(random, bid.SaleDM, brokerScore, out roll);
bid.Roll = roll;
requests.Add(bid);
}
}
else
foreach (var good in goods)
foreach (var detail in good.Details)
foreach (var name in detail.NameList)
{
var bid = new TradeBid()
{
Type = good.Name,
Subtype = name,
BasePrice = detail.Price * 1000,
SaleDM = SaleDM(origin, good),
};
//TODO: Auto-bump the price so that the merchant isn't buying from the PCs at a higher price than he would sell to them
//.........这里部分代码省略.........
示例4: Freight
public override FreightList Freight(World origin, World destination, Dice random)
{
var result = new FreightList();
var baseDM = 0;
var incidentalDM = 2;
var minorDM = 0;
var majorDM = -4;
if (origin.PopulationCode.Value <= 1)
baseDM += -4;
else if (origin.PopulationCode.Value == 6 || origin.PopulationCode.Value == 7)
baseDM += 2;
else if (origin.PopulationCode.Value >= 8)
baseDM += 4;
if (origin.TechCode.Value <= 6) baseDM += -1;
if (origin.TechCode.Value >= 9) baseDM += -2;
if (origin.ContainsRemark("A")) baseDM += -2;
if (origin.ContainsRemark("R")) baseDM += -6;
result.Incidental = random.D(FreightTraffic(baseDM + incidentalDM, random));
result.Minor = random.D(FreightTraffic(baseDM + minorDM, random));
result.Major = random.D(FreightTraffic(baseDM + majorDM, random));
var lots = new List<FreightLot>();
for (var i = 0; i < result.Incidental; i++)
{
int size = random.D("1D6");
int value = FreightCost(destination.JumpDistance) * size;
lots.Add(new FreightLot(size, value));
}
for (var i = 0; i < result.Minor; i++)
{
int size = random.D("1D6") * 5;
int value = FreightCost(destination.JumpDistance) * size;
lots.Add(new FreightLot(size, value));
}
for (var i = 0; i < result.Major; i++)
{
int size = random.D("1D6") * 10;
int value = FreightCost(destination.JumpDistance) * size;
lots.Add(new FreightLot(size, value));
}
//Add contents
foreach (var lot in lots)
{
var good = random.Choose(m_LegalTradeGoods);
var detail = good.ChooseRandomDetail(random);
lot.Contents = detail.Name;
lot.ActualValue = detail.Price * 1000 * lot.Size;
}
result.Lots.AddRange(lots.OrderByDescending(f => f.Size));
return result;
}