本文整理汇总了C#中Cyclades.Context类的典型用法代码示例。如果您正苦于以下问题:C# Context类的具体用法?C# Context怎么用?C# Context使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Context类属于Cyclades命名空间,在下文中一共展示了Context类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: TestImplContext
protected override Enum TestImplContext(Context context)
{
if (!IsPegusus && context.turn.CurrentGod != God.Mars)
return TestResult.InvalidGod;
gold = Constants.moveArmyCost;
if (player.Gold < gold)
return TestResult.NotEnoughtGold;
if (islandFromID < 0 || islandFromID >= context.map.Islands.Count || islandToID < 0 || islandToID >= context.map.Islands.Count)
return TestResult.InvalidIslandID;
if (islandFromID == islandToID)
return TestResult.FromAndToEqual;
if (count < 1 || count > context.map.GetArmyCountByIsland(islandFromID, playerID))
return TestResult.InvalidCount;
if (!context.map.HasIslandsShipBrige(islandFromID, islandToID, playerID))
return TestResult.DontConnectIslands;
if (context.map.IsThereCreatureOnIsland(Card.Gorgon, islandFromID))
return TestResult.Gorgone;
return TestResult.OK;
}
开发者ID:AciesNN,项目名称:cyc,代码行数:26,代码来源:MoveArmy.cs
示例2: TestImpl
protected override bool TestImpl(Context context)
{
if (context.turn.GetNextPlayerID() != PlayerInfoCM.NoID)
return false;
return true;
}
开发者ID:AciesNN,项目名称:cyc,代码行数:7,代码来源:EndTurn.cs
示例3: GetUnitOfWorkImpl
protected override UnitOfWork GetUnitOfWorkImpl(Context context)
{
List<int> turnPlayersOrder = new List<int>();
List<int> golds = new List<int>(context.players.PlayersCount);
for (int i = 0; i < context.players.PlayersCount; ++i)
golds.Add(0);
for (int i = 0; i < context.auction.GodsOrder.Count; ++i)
{
AuctionCM.Bet bet = context.auction.GetMaxBetForGod(context.auction.GodsOrder[i]);
if (bet != null)
{
golds[bet.playerID] = AuctionCM.GoldForBet(context.players.GetPlayer(bet.playerID), bet.bet);
turnPlayersOrder.Add(bet.playerID);
}
}
List<AuctionCM.Bet> apolloBets = context.auction.GetOrderedGodBets(God.Appolon);
turnPlayersOrder.AddRange( apolloBets.Select(b => b.playerID).ToList() );
UOW uow = new UOW()
{
turnPlayersOrder = turnPlayersOrder,
golds = golds
};
return uow;
}
开发者ID:AciesNN,项目名称:cyc,代码行数:28,代码来源:AuctionEnd.cs
示例4: DoImplContext
protected override void DoImplContext(Context context)
{
context.turn.CountTurnActionCounter();
context.players.GetPlayer(playerID).ChangeMarkerValue(PlayerInfoCM.Marker.Philosopher, 1);
if (gold > 0)
context.players.GetPlayer(playerID).ChangeMarkerValue(PlayerInfoCM.Marker.Gold, -gold);
}
开发者ID:AciesNN,项目名称:cyc,代码行数:7,代码来源:BuyPhilosopher.cs
示例5: GetUnitOfWorkImpl
protected override UnitOfWork GetUnitOfWorkImpl(Context context)
{
if (playerID == context.armyFight.AttackPlayerID)
{
UnitOfWork uow = new UOW_AttackRetreat()
{
playerID = playerID,
islandFromID = context.armyFight.DefenceIslandID,
islandToID = islandID,
count = context.armyFight.AttackCount
};
return uow;
}
else
{
UnitOfWork uow = new UOW_DefenceRetreat()
{
playerID = playerID,
islandFromID = context.armyFight.DefenceIslandID,
islandToID = islandID,
count = context.armyFight.DefenceCount,
killMinotaurus = context.armyFight.IsMinotaurus,
changeOwner = changeOwner
};
return uow;
}
}
开发者ID:AciesNN,项目名称:cyc,代码行数:28,代码来源:PassArmyFight.cs
示例6: GetUnitOfWorkImpl
protected override UnitOfWork GetUnitOfWorkImpl(Context context)
{
List<God> gods = new List<God>() { God.Mars, God.Sophia, God.Poseidon, God.Zeus };
List<God> godsOrder = new List<God>();
for (int i = 0; i < context.players.PlayersCount - 1; ++i)
{
int randomGod = context.Randomizer.Range(0, gods.Count-1);
godsOrder.Add(gods[randomGod]);
gods.RemoveAt(randomGod);
}
List<int> gold = new List<int>();
for (int i = 0; i < context.players.PlayersCount; ++i )
{
gold.Add(context.map.GetIncome(i));
}
List<int> random = new List<int>();
int randomCount = context.cards.GetNewCardCountAfterShift();
int cardCount = Enum.GetValues(typeof(Card)).Length - 1;
for (int i = 0; i < randomCount; i++)
random.Add(context.Randomizer.Range(0, cardCount));
UnitOfWork uow = new UOW()
{
godsOrder = godsOrder,
gold = gold,
random = random
};
return uow;
}
开发者ID:AciesNN,项目名称:cyc,代码行数:31,代码来源:AuctionInit.cs
示例7: TestImplContext
protected override Enum TestImplContext(Context context)
{
if (god == God.None)
return TestResult.GodNoneBet;
if (bet < 1)
return TestResult.TooSmallBet;
if (god != God.Appolon && player.Gold < AuctionCM.GoldForBet(player, bet))
return TestResult.NotEnoughtGold;
if (!context.auction.GodPossibleToBet(player.ID, god))
return TestResult.GodDontPossibleToBet;
AuctionCM.Bet maxBet = context.auction.GetMaxBetForGod(god);
int maxbet = (maxBet == null ? 0 : maxBet.bet);
if (god != God.Appolon)
{
if (bet < maxbet)
return TestResult.TooSmallBet;
}
else
{
if (bet != maxbet + 1)
return TestResult.WrongApolloBet;
}
return TestResult.OK;
}
开发者ID:AciesNN,项目名称:cyc,代码行数:30,代码来源:MakeBet.cs
示例8: DoImplContext
protected override void DoImplContext(Context context)
{
for (int i = 0; i < builds.Count; ++i)
context.map.DestroyBuild(builds[i]);
context.map.BuildMetro(islandID);
}
开发者ID:AciesNN,项目名称:cyc,代码行数:7,代码来源:PlaceMetro4Buildings.cs
示例9: CheckBuildAndMoveNavy
private static VariantOffer CheckBuildAndMoveNavy(Context context, PlayerInfoCM player, AIOptions options, int restOfGold)
{
VariantOfferPackage package = new VariantOfferPackage();
int restUnits = Math.Min(Constants.maxArmyCount - context.map.Navy.Where(e => e.OwnerID == player.ID).Count(), Constants.armyPrices.Count);
if (restUnits < 1)
return null;
List<IslandCM> enemyNeibourIslands = Library.Map.GetEnemyNeibourIslands(context.map, player.ID, false);
float maxNeedBridgeVP = 0;
for (int i = 0; i < enemyNeibourIslands.Count; ++i)
{
IslandCM enemyIsland = enemyNeibourIslands[i];
float vp = Library.Map.GetIslandPriceVP(context.map, enemyIsland.ID, player.ID, options) * options.coefficients.BridgeToIslandPriceCoeff;
if (vp > maxNeedBridgeVP)
maxNeedBridgeVP = vp;
}
if (maxNeedBridgeVP > 0)
package.Add(new VariantOffer(0, maxNeedBridgeVP));
if (Library.Map.GetAccessibleSeaHorns(context.map, player.ID, false, false).Count > 0)
package.Add(new VariantOffer(Constants.moveNavyCost + Constants.navyPrices[1], options.coefficients.HornVPT * options.turnsToEnd));
return package.GetSum();
}
开发者ID:AciesNN,项目名称:cyc,代码行数:26,代码来源:AuctionPoseidon.cs
示例10: TestImplContext
protected override Enum TestImplContext(Context context)
{
if (islandID < 0 || islandID >= context.map.Islands.Count)
return TestResult.InvalidIslandID;
IslandCM island = context.map.Islands[islandID];
if (island.OwnerID != playerID)
return TestResult.AlienIsland;
if (builds.Count == 0)
builds = context.map.GetBuildsAddrsForMetro(playerID, islandID);
if (builds.Count != 4)
return TestResult.WrongBuilds;
if (builds.Select(a => context.map.GetBuild(a)).Where(b => b != Build.None).Count() != builds.Count)
return TestResult.WrongBuilds;
for (int i = 0; i < IslandCM.IslandMetroSizeByIslandSize(island.Size); ++i)
{
SlotAddr addr = SlotAddr.Create(islandID, i);
if (island.Slots[i] != Build.None && !builds.Contains(addr))
return TestResult.WrongBuilds;
}
return TestResult.OK;
}
开发者ID:AciesNN,项目名称:cyc,代码行数:27,代码来源:PlaceMetro4Buildings.cs
示例11: DoImplContext
protected override void DoImplContext(Context context)
{
if (killNavyCount > 0)
context.map.KillNavy(cell, killNavyPlayerID, killNavyCount);
context.map.CreateKraken(cell);
}
开发者ID:AciesNN,项目名称:cyc,代码行数:7,代码来源:UseCardKra.cs
示例12: UseCardSyl
public UseCardSyl() : base() { } //JSON Constructor
protected override Enum TestImplContext(Context context)
{
if (context.cards.ActiveOpenCard != Card.Sylph)
return TestResult.WrongCard;
return TestResult.OK;
}
开发者ID:AciesNN,项目名称:cyc,代码行数:9,代码来源:UseCardSyl.cs
示例13: DoImplContext
protected override void DoImplContext(Context context)
{
context.map.KillNavy(cell, enemyID);
if (change)
context.map.BuyNavy(playerID, cell);
}
开发者ID:AciesNN,项目名称:cyc,代码行数:7,代码来源:UseCardMer.cs
示例14: TestImplContext
protected override Enum TestImplContext(Context context)
{
if (context.turn.CurrentGod != God.Mars)
return TestResult.InvalidGod;
gold = Constants.moveNavyCost;
if (player.Gold < gold)
return TestResult.NotEnoughtGold;
if (from == to)
return TestResult.FromAndToEqual;
if (!context.map.IsPointsNeibours(from, to))
return TestResult.NotNeibours;
if (count < 1 || count > context.map.GetNavyCountByCell(from, playerID))
return TestResult.InvalidCount;
if (context.turn.MoveNavyLastCell != null && context.turn.MoveNavyLastCell != from)
return TestResult.BrokenMove;
if (!context.map.IsPointAccessibleForShip(to, playerID, true))
return TestResult.ForbiddenHex;
return TestResult.OK;
}
开发者ID:AciesNN,项目名称:cyc,代码行数:26,代码来源:MoveNavy.cs
示例15: GetUnitOfWorkImpl
protected override UnitOfWork GetUnitOfWorkImpl(Context context)
{
UnitOfWork uow = new UOW()
{
};
return uow;
}
开发者ID:AciesNN,项目名称:cyc,代码行数:7,代码来源:StopMoveNavy.cs
示例16: TestImplContext
protected override Enum TestImplContext(Context context)
{
if (context.turn.CurrentGod != God.Poseidon)
return TestResult.InvalidGod;
if (!context.map.IsPointOnMap(hex))
return TestResult.InvalidHex;
if (!context.map.GetNeiborIslandsByMapPos(hex).Any(i => i.OwnerID == playerID))
return TestResult.AlienIsland;
if (!context.map.IsPointAccessibleForShip(hex, playerID, false))
return TestResult.ForbiddenHex;
if (context.map.Navy.Where(a => a.OwnerID == playerID).Count() >= Constants.maxNavyCount)
return TestResult.NotEnouthUnit;
if (context.turn.TurnActionCounter >= Constants.navyPrices.Count)
return TestResult.NotEnouthActions;
gold = Constants.navyPrices[context.turn.TurnActionCounter];
if (player.Gold < gold)
return TestResult.NotEnouthGold;
return TestResult.OK;
}
开发者ID:AciesNN,项目名称:cyc,代码行数:26,代码来源:BuyNavy.cs
示例17: TestImplContextCurrentCard
protected override bool TestImplContextCurrentCard(Context context)
{
if (context.map.IsThereCreatureOnIsland(Card.Chiron, islandID))
return false;
return base.TestImplContextCurrentCard(context);
}
开发者ID:AciesNN,项目名称:cyc,代码行数:7,代码来源:UseCardGor.cs
示例18: DoImplContext
protected override void DoImplContext(Context context)
{
if (isNeedTrashActiveCard)
context.cards.TrashActiveCard();
if (isNeedRefreshStack)
context.cards.RefreshStack();
}
开发者ID:AciesNN,项目名称:cyc,代码行数:8,代码来源:ReInitTurn.cs
示例19: GetUnitOfWorkImpl
protected override UnitOfWork GetUnitOfWorkImpl(Context context)
{
UnitOfWork uow = new UOW()
{
move = Constants.sylphNavyMove
};
return uow;
}
开发者ID:AciesNN,项目名称:cyc,代码行数:8,代码来源:UseCardSyl.cs
示例20: DoImplContext
protected override void DoImplContext(Context context)
{
if (count > 0)
{
context.players.GetPlayer(enemyID).ChangeMarkerValue(PlayerInfoCM.Marker.Philosopher, -count);
context.players.GetPlayer(playerID).ChangeMarkerValue(PlayerInfoCM.Marker.Philosopher, +count);
}
}
开发者ID:AciesNN,项目名称:cyc,代码行数:8,代码来源:UseCardSat.cs
注:本文中的Cyclades.Context类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论