Showing 1,158 of 1,158 total issues
Function play
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
play(free_play = false, move_card = true, source = 'hand', number_of_times = 1, announce = true) {
let duration = false
_.times(number_of_times, (play_count) => {
if (this.can_play(free_play)) {
this.update_phase(free_play)
Function play
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
play(game, player_cards, card_player) {
let action_gainer = new ActionGainer(game, player_cards)
action_gainer.gain(1)
let victory_cards = _.filter(player_cards.hand, function(card) {
Function play
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
play(game, player_cards, card_player) {
let action_gainer = new ActionGainer(game, player_cards)
action_gainer.gain(1)
let card_mover = new CardMover(game, player_cards)
Function play
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
play(game, player_cards, card_player) {
let action_gainer = new ActionGainer(game, player_cards)
action_gainer.gain(1)
let buy_gainer = new BuyGainer(game, player_cards)
Function play
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
play(game, player_cards, card_player) {
let card_drawer = new CardDrawer(game, player_cards, card_player)
card_drawer.draw(1)
let action_gainer = new ActionGainer(game, player_cards)
Function play
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
play(game, player_cards, card_player) {
let card_drawer = new CardDrawer(game, player_cards, card_player)
card_drawer.draw(1)
let action_gainer = new ActionGainer(game, player_cards)
Function attack
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
attack(game, player_cards) {
if (game.turn.pirate_ship_attack) {
if (_.size(player_cards.deck) === 0 && _.size(player_cards.discard) === 0) {
game.log.push(` <strong>${player_cards.username}</strong> has no cards in deck`)
} else {
Function trash_card
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static trash_card(game, player_cards, selected_cards) {
if (!_.isEmpty(selected_cards)) {
let is_active_player = game.turn.player._id === player_cards.player_id
let remodel_amount = is_active_player ? 2 : 1
Function buy
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
buy(game, player_cards) {
if (!player_cards.tokens.minus_coin) {
game.log.push(` <strong>${player_cards.username}</strong> takes their -$1 token`)
player_cards.tokens.minus_coin = true
} else {
Function buy
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
buy(game, player_cards) {
let buy_gainer = new BuyGainer(game, player_cards)
buy_gainer.gain(1)
if (_.size(player_cards.deck) === 0 && _.size(player_cards.discard) === 0) {
Function player
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
player() {
let player = PlayerRankings.findOne({username: FlowRouter.getParam('id')}, {
transform: function(player) {
let total_games = player.wins + player.losses
player.win_ratio = total_games === 0 ? 0 : ((player.wins / total_games) * 100).toFixed(2)
Function process
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
process() {
if (!_.isEmpty(this.trash_events)) {
let mandatory_trash_events = _.filter(this.trash_events, function(event) {
return _.includes(TrashEventProcessor.event_cards().concat(TrashEventProcessor.landmark_cards().concat(['Priest'])), event.name)
})
Function play
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
play(game, player_cards) {
if (_.size(game.turn.gained_cards) > 1) {
let card_gainer = new CardGainer(game, player_cards, 'discard', 'Imp')
card_gainer.gain()
} else if (_.size(game.turn.gained_cards) == 1) {
Function lobby
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
lobby() {
let proposals = Proposals.find({}, {
transform: function(proposal) {
proposal.is_proposer = proposal.proposer.id == Meteor.userId()
_.each(proposal.players, function(player) {
Function gain_event
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
gain_event(gainer, blessed_village) {
if (_.size(gainer.game.boons_deck) === 0) {
gainer.game.boons_deck = _.shuffle(gainer.game.boons_discard)
gainer.game.boons_discard = []
}
Function draw_cards
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static draw_cards(game, player_cards) {
if (_.size(player_cards.hand) >= 7 || (_.size(player_cards.deck) === 0 && _.size(player_cards.discard) === 0)) {
if (_.size(player_cards.aside) > 0) {
let card_discarder = new CardDiscarder(game, player_cards, 'aside')
card_discarder.discard()
Function set_aside_prince
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static set_aside_prince(game, player_cards, response, prince) {
if (response === 'yes') {
let card_mover = new CardMover(game, player_cards)
if (card_mover.move(player_cards.in_play, player_cards.aside, prince)) {
game.log.push(` <strong>${player_cards.username}</strong> sets aside ${CardView.render(prince)}`)
Function attack
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
attack(game, player_cards) {
if (_.size(player_cards.deck) === 0 && _.size(player_cards.discard) === 0) {
game.log.push(` <strong>${player_cards.username}</strong> has no cards in deck`)
} else {
let card_revealer = new CardRevealer(game, player_cards)
Function buy
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
buy(game, player_cards) {
game.turn.forbidden_events.push(this.name())
let treasures = _.filter(player_cards.in_play, function(card) {
return _.includes(_.words(card.types), 'treasure')
})
Function play
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
play(game, player_cards, card_player) {
let victory_token_gainer = new VictoryTokenGainer(game, player_cards)
victory_token_gainer.gain(1)
let unique_cards = _.uniqBy(player_cards.hand, 'name')