Skip to content

Commit

Permalink
Merge pull request #6906 from ryandriskel/feature/18EU_Dedupe_Tokens
Browse files Browse the repository at this point in the history
18EU Remove redundant tokens after upgrade (Take two)
  • Loading branch information
tobymao authored Feb 2, 2022
2 parents f64ce44 + d7a6ff8 commit f523278
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/engine/game/g_18_eu/step/track.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,23 @@ def process_lay_tile(action)

super
end

def update_token!(_action, _entity, tile, old_tile)
super

return if old_tile.cities.size == 1 || tile.color != :brown

tile.cities.each do |city|
prev = nil
city.tokens.compact.sort_by { |t| t.corporation.name }.each do |token|
if prev&.corporation == token.corporation
prev.remove!
@game.log << "#{token.corporation.name} redundant token removed from #{tile.hex.name}"
end
prev = token
end
end
end
end
end
end
Expand Down

0 comments on commit f523278

Please sign in to comment.