summaryrefslogtreecommitdiffstats
path: root/lib/colonial_twilight/cards.rb
blob: 4bc7a9fd2df113c20db959f2702f51636c829665 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#! /usr/bin/env ruby
# -*- coding: UTF-8 -*-

module ColonialTwilight

  CARD_SINGLE=1
  CARD_FLN_MARKED=2
  CARD_ALWAYS_PLAY=4

  class Card
    attr_reader :num, :title
    def initialize n, t, attr, a0=nil, a1=nil
      @num = n
      @title = t
      @attributes = attr
      @a0 = a0
      @a1 = a1
    end
    def dual?; @attributes & CARD_SINGLE == 0 end
    def single?; @attributes & CARD_SINGLE == CARD_SINGLE end
    def flnmarked?; @attributes & CARD_FLN_MARKED == CARD_FLN_MARKED end
    def alwaysplay?; @attributes & CARD_ALWAYS_PLAY == CARD_ALWAYS_PLAY end
    def check
      # @attributes.each do |attr| raise "unknown attribute : #{attr}" if attr not in ATTRS end
      puts single?
      puts dual?
      puts flnmarked?
      puts alwaysplay?
    end
  end

  class CardAction
    def initialize t, c
      @txt = t
      @condition=c
    end
  end

  class Deck
    attr_reader :cards
    def initialize
      @cards = {}
      add_card 1, 'Quadrillage', 0, CardAction.new('Place up to all French Police in Available in up to 3 spaces', {:what=>:french_police,:from=>:available})
    end

    def pull n; @cards[n] end

    private

    def add_card num, title, attrs, action
      @cards[num] = Card.new num, title, attrs
      @cards[num].check
    end

  end

end

 # 'Balky Conscripts'
 # 'Leadership Snatch'
 # 'Oil & Gas Discoveries'
 # 'Peace of the Brave'
 # 'Factionalism'
 # '5th Bureau'
 # 'Cross-border air strike'
 # 'Beni-Oui-Oui'
 # 'Moudjahidine'
 # 'Bananes'
 # 'Ventilos'
 # 'SAS'
 # 'Protest in Paris'
 # 'Jean-Paul Sarte'
 # 'NATO'
 # 'Commandos'
 # 'Torture'
 # 'General Strike'
 # 'Sauve qui peut'
 # 'United Nations Resolution'
 # 'The Government of USA is Convinced...'
 # 'Diplomatic Leanings'
 # 'Economic Development'
 # 'Purge'
 # 'Casbah'
 # 'Covert Movement'
 # 'Atrocities and Reprisals'
 # 'The Call Up'
 # 'Change in Tactics'
 # 'Intimidation'
 # 'Teleb the Bomb-maker'
 # 'Overkill'
 # 'Elections'
 # 'Napalm'
 # 'Assassination'
 # 'Integration'
 # 'Economic Crisis in France'
 # 'Retreat into Djebel'
 # 'Strategic Movement'
 # 'Egypt'
 # 'Czech Arms Deal'
 # 'Refugees'
 # 'Paranoia'
 # 'Challe Plan'
 # 'Moghazni'
 # 'Third Force'
 # 'Ultras'
 # 'Factional Plot'
 # 'Bleuite'
 # 'Stripey Hole'
 # 'Cabinet Shuffle'
 # 'Population Control'
 # 'Operation 744'
 # 'Development'
 # 'Hardened Attitudes'
 # 'Peace Talks'
 # 'Army in Waiting'
 # 'Bandung Conference'
 # 'Soummam Conference'
 # 'Morocco and Tunisia Independent'
 # 'Suez Crisis'
 # 'OAS'
 # 'Mobilization'
 # 'Recall De Gaulle'
 # "Coup d'etat"
 # "Propaganda!"
 # "Propaganda!"
 # "Propaganda!"
 # "Propaganda!"
 # "Propaganda!"