Add collectible fish quality tiers
This commit is contained in:
parent
7661b057bc
commit
35d00e8035
30 changed files with 834 additions and 73 deletions
|
|
@ -1,6 +1,8 @@
|
|||
class_name FishBuyerProfile
|
||||
extends Resource
|
||||
|
||||
const FishQualityType = preload("res://fish/fish_quality.gd")
|
||||
|
||||
@export var id: StringName
|
||||
@export var display_name: String
|
||||
@export var animal_name_singular: String
|
||||
|
|
@ -25,6 +27,18 @@ func get_offer(base_value: int) -> int:
|
|||
return maxi(offer, 0)
|
||||
|
||||
|
||||
func get_quality_offer(base_value: int, quality: int) -> int:
|
||||
if not FishQualityType.is_valid(quality):
|
||||
return -1
|
||||
var ordinary_offer: int = get_offer(base_value)
|
||||
var adjusted_offer: int = get_offer(
|
||||
FishQualityType.apply_sale_value(base_value, quality)
|
||||
)
|
||||
if ordinary_offer < 0 or adjusted_offer < 0:
|
||||
return -1
|
||||
return maxi(adjusted_offer, ordinary_offer + quality)
|
||||
|
||||
|
||||
func get_sale_message(
|
||||
fish_name: String,
|
||||
payout: int,
|
||||
|
|
|
|||
|
|
@ -128,7 +128,15 @@ func _validate_batch(
|
|||
if fish_catch.sale_value < 0:
|
||||
result.status = FishSaleResultType.Status.INVALID_VALUE
|
||||
return result
|
||||
var offer: int = buyer.get_offer(fish_catch.sale_value)
|
||||
var ordinary_value: int = (
|
||||
fish_catch.fish.get_sale_value_for_weight(
|
||||
fish_catch.weight_lb
|
||||
)
|
||||
)
|
||||
var offer: int = buyer.get_quality_offer(
|
||||
ordinary_value,
|
||||
fish_catch.quality,
|
||||
)
|
||||
if offer < 0:
|
||||
result.status = FishSaleResultType.Status.INVALID_OFFER
|
||||
return result
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue