* Make weapon key series an array Draconic Weapons Providence can have original Draconic Weapon keys, but also have a new key that can only be equipped to them. Thanks, Cygames. * Update weapon.rb * Update to check key compatibility against an array instead of an int * Add convenience function to check if the weapon is part of a Draconic Weapon series * Update grid_weapon.rb Update conflict detection to: * Detect Draconic Weapons Providence * Add multiple weapons to conflicting weapons instead of just one * (WIP) Update conflict view rendering Conflict blueprints should render multiple conflict weapons instead of just one. Also adds Draconic Weapon Providence series to various places that check series by number * Finish last bugs We tested to ensure that conflict resolution appears for * Opus and Draconic * Draconic and Draconic 2 * Draconic 2 + Opus and Draconic 1
31 lines
1.1 KiB
Ruby
31 lines
1.1 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
module Api
|
|
module V1
|
|
class ConflictBlueprint < Blueprinter::Base
|
|
field :position, if: ->(_fn, _obj, options) { options.key?(:incoming_position) } do |_, options|
|
|
options[:incoming_position]
|
|
end
|
|
|
|
view :characters do
|
|
field :conflicts, if: ->(_fn, _obj, options) { options.key?(:conflict_characters) } do |_, options|
|
|
GridCharacterBlueprint.render_as_hash(options[:conflict_characters], view: :nested)
|
|
end
|
|
|
|
field :incoming, if: ->(_fn, _obj, options) { options.key?(:incoming_character) } do |_, options|
|
|
CharacterBlueprint.render_as_hash(options[:incoming_character])
|
|
end
|
|
end
|
|
|
|
view :weapons do
|
|
field :conflicts, if: ->(_fn, _obj, options) { options.key?(:conflict_weapons) } do |_, options|
|
|
GridWeaponBlueprint.render_as_hash(options[:conflict_weapons], view: :nested)
|
|
end
|
|
|
|
field :incoming, if: ->(_fn, _obj, options) { options.key?(:incoming_weapon) } do |_, options|
|
|
WeaponBlueprint.render_as_hash(options[:incoming_weapon])
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|