本文整理汇总了Golang中github.com/twoodhouse/coup-sim/model/log.Entity.CreateCardKilled方法的典型用法代码示例。如果您正苦于以下问题:Golang Entity.CreateCardKilled方法的具体用法?Golang Entity.CreateCardKilled怎么用?Golang Entity.CreateCardKilled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/twoodhouse/coup-sim/model/log.Entity
的用法示例。
在下文中一共展示了Entity.CreateCardKilled方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: DoTurn
//.........这里部分代码省略.........
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" {
player.AddCoins(1)
table.AddCoins(-1)
}
if action == "foreign_aid" && !challengeLoss && !player.Dead() {
player.AddCoins(2)
table.AddCoins(-2)
}
if (action == "tax" || action == "steal" || action == "coup") && !player.Dead() {
targetedPlayer = playerByName(otherPlayers, target)
}
if action == "tax" && !challengeLoss && !player.Dead() {
player.AddCoins(3)
table.AddCoins(-3)
}
if action == "steal" && !challengeLoss && !player.Dead() {
player.AddCoins(2)
targetedPlayer.AddCoins(-2)
}
if action == "coup" && !player.Dead() {
player.AddCoins(-7)
log.CreateCardKilled(revealCard(targetedPlayer, table, log))
}
if action == "assassinate" && !challengeLoss && !player.Dead() && !targetedPlayer.Dead() {
log.CreateCardKilled(revealCard(targetedPlayer, table, log))
}
if action == "exchange" && !challengeLoss && !player.Dead() {
table.CenterDeck().ShuffleCards()
player.Deck().ShuffleCards()
c1 := table.CenterDeck().TakeCards(1)[0]
c2 := table.CenterDeck().TakeCards(1)[0]
player.Deck().GiveCards([]int{c1, c2})
r1, r2 := player.Strategy().GetExchangeReturnChoices(log, table.PlayerNames(), table.PlayerCoins(), table.FaceupDecks(), player.Deck())
if !player.Deck().HasCards(r1, r2) {
disqualifyPlayer(player, table, log, "Player gave invalid card returns "+strconv.Itoa(r1)+","+strconv.Itoa(r2))
table.CenterDeck().GiveCards([]int{c1, c2})
} else {
fourCards := player.Deck().TakeCards(player.Deck().Size())
returnToTableCards := make([]int, 2)
r1found := false
r2found := false
for i := range fourCards {
var index int
if returnToTableCards[1] == 0 {
index = 1
}
if returnToTableCards[0] == 0 {
index = 0
}
if fourCards[i] == r1 && !r1found {
r1found = true
returnToTableCards[index] = fourCards[i]
} else if fourCards[i] == r2 && !r2found {
r2found = true
returnToTableCards[index] = fourCards[i]
} else {
player.Deck().GiveCards([]int{fourCards[i]})
}
}
table.CenterDeck().GiveCards(returnToTableCards)
player.Deck().ShuffleCards()
}
}
if table.FaceupDecks()[player.Name()][0] != 0 && table.FaceupDecks()[player.Name()][1] != 0 {
player.Kill()
}
for i := 0; i < len(otherPlayers); i++ {
if table.FaceupDecks()[otherPlayers[i].Name()][0] != 0 && table.FaceupDecks()[otherPlayers[i].Name()][1] != 0 {
otherPlayers[i].Kill()
}
}
return log, table
}