本文整理汇总了Golang中github.com/twoodhouse/coup-sim/model/log.Entity.CreateBlockChallengeCardLoss方法的典型用法代码示例。如果您正苦于以下问题:Golang Entity.CreateBlockChallengeCardLoss方法的具体用法?Golang Entity.CreateBlockChallengeCardLoss怎么用?Golang Entity.CreateBlockChallengeCardLoss使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/twoodhouse/coup-sim/model/log.Entity
的用法示例。
在下文中一共展示了Entity.CreateBlockChallengeCardLoss方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: DoTurn
//.........这里部分代码省略.........
neededCardAction = "steal"
} else if blockCardClaim == 5 {
neededCardAction = "exchange"
} else {
disqualifyPlayer(targetedPlayer, table, log, "Block card '"+strconv.Itoa(blockCardClaim)+"' is not valid for blocking steal'")
}
} else if action == "assassinate" {
neededCardAction = "block"
}
challengeSuccess := !targetedPlayer.Deck().HasCardForAction(neededCardAction)
losingPlayer := player
var cardValue int
if challengeSuccess {
losingPlayer = targetedPlayer
} else {
challengeLoss = true
losingPlayer = player
switch neededCardAction {
case "tax":
cardValue = 1
case "steal":
cardValue = 2
case "assassinate":
cardValue = 3
case "block":
cardValue = 4
case "exchange":
cardValue = 5
}
swapChallengedCard(targetedPlayer, table, log, cardValue)
}
log.CreateBlockChallenge(challengeSuccess)
cardLoss := revealCard(losingPlayer, table, log)
log.CreateBlockChallengeCardLoss(cardLoss)
} else {
challengeLoss = true
}
}
}
if action == "foreign_aid" && !player.Dead() && !challengeLoss && !targetedPlayer.Dead() {
for i := 0; i < len(otherPlayers); i++ {
if !otherPlayers[i].Dead() && otherPlayers[i].Strategy().GetBlock(log, table.PlayerNames(), table.PlayerCoins(), table.FaceupDecks(), otherPlayers[i].Deck()) {
log.CreateBlock()
challengeLoss = true
log.CreateBlocker(otherPlayers[i].Name())
if player.Strategy().GetChallenge(log, table.PlayerNames(), table.PlayerCoins(), table.FaceupDecks(), player.Deck()) {
challengeSuccess := !otherPlayers[i].Deck().HasCardForAction("tax")
losingPlayer := player
if challengeSuccess {
losingPlayer = otherPlayers[i]
challengeLoss = false
} else {
losingPlayer = player
swapChallengedCard(otherPlayers[i], table, log, 1)
}
log.CreateBlockChallenge(challengeSuccess)
cardLoss := revealCard(losingPlayer, table, log)
log.CreateBlockChallengeCardLoss(cardLoss)
}
break
}
}
}
if action == "income" {