Class: CARPS::Player::Mod
Overview
Player mod
subclasses should provide a method called description
description should return a string, a summary of the game. Who wrote it, owns the copyright and where to find the rules are appropriate facts.
Instance Method Summary collapse
-
#configured ⇒ Object
This game has been configured.
-
#edit_sheet ⇒ Object
Edit the character sheet.
-
#first_time? ⇒ Boolean
This game has never been run before.
-
#initialize ⇒ Mod
constructor
A new instance of Mod.
-
#next_turn ⇒ Object
Send answers to dungeon master.
-
#save ⇒ Object
Save the game.
-
#show_sheet ⇒ Object
Show the character sheet.
-
#take_turn ⇒ Object
Take a turn.
Methods inherited from Mod
Constructor Details
Instance Method Details
#configured ⇒ Object
This game has been configured
41 42 43 |
# File 'lib/carps/mod/player/mod.rb', line 41 def configured @first_time = false end |
#edit_sheet ⇒ Object
Edit the character sheet
51 52 53 54 |
# File 'lib/carps/mod/player/mod.rb', line 51 def edit_sheet editor.fill @sheet @edited = true end |
#first_time? ⇒ Boolean
This game has never been run before
46 47 48 |
# File 'lib/carps/mod/player/mod.rb', line 46 def first_time? @first_time end |
#next_turn ⇒ Object
Send answers to dungeon master
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/carps/mod/player/mod.rb', line 88 def next_turn if @answers @mailer.relay @answers @turn = nil done = true end if @edited @edited = false @mailer.relay Sheet::NewSheet.new @sheet.attributes done = true end unless done UI::put_error "Nothing to send." end save end |
#save ⇒ Object
Save the game
62 63 64 |
# File 'lib/carps/mod/player/mod.rb', line 62 def save @mailer.save self end |
#show_sheet ⇒ Object
Show the character sheet
57 58 59 |
# File 'lib/carps/mod/player/mod.rb', line 57 def show_sheet puts @sheet.emit end |
#take_turn ⇒ Object
Take a turn
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/carps/mod/player/mod.rb', line 67 def take_turn if @turn @answers = @turn.take else tu = @mailer.check ClientTurn if tu @turn = tu stats = @turn.sheet.dump unless stats.empty? @sheet = Sheet::Character.new stats UI::highlight "Received new character sheet." end @answers = @turn.take else UI::put_error "Turn not received." end end save end |