|
|
@ -5,6 +5,11 @@ class Combat < ApplicationRecord
|
|
|
|
belongs_to :right_fighter, class_name: 'Creature'
|
|
|
|
belongs_to :right_fighter, class_name: 'Creature'
|
|
|
|
belongs_to :winner, class_name: 'Creature', optional: true
|
|
|
|
belongs_to :winner, class_name: 'Creature', optional: true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def to_label
|
|
|
|
|
|
|
|
return "Invalid combat" unless valid?
|
|
|
|
|
|
|
|
"Combat '#{name}' entre #{left_fighter.name} et #{right_fighter.name}"
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def baston!
|
|
|
|
def baston!
|
|
|
|
return if left_fighter.nil? || right_fighter.nil?
|
|
|
|
return if left_fighter.nil? || right_fighter.nil?
|
|
|
|
|
|
|
|
|
|
|
|