diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2020-08-05 19:14:26 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2020-08-05 19:14:26 +0200 |
commit | 94d2e329a4b9c325b32de5bd641e5e1e99a1c8f4 (patch) | |
tree | 1d9f733e12eb8dc27610da0d52674ae1aec9fefc /lib/colonial_twilight/cards.rb | |
download | colonial-twilight-94d2e329a4b9c325b32de5bd641e5e1e99a1c8f4.zip colonial-twilight-94d2e329a4b9c325b32de5bd641e5e1e99a1c8f4.tar.gz |
Inital commit
Diffstat (limited to 'lib/colonial_twilight/cards.rb')
-rw-r--r-- | lib/colonial_twilight/cards.rb | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/lib/colonial_twilight/cards.rb b/lib/colonial_twilight/cards.rb new file mode 100644 index 0000000..4bc7a9f --- /dev/null +++ b/lib/colonial_twilight/cards.rb @@ -0,0 +1,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!" |