Skip to content

Commit

Permalink
Merge pull request #358 from db0/0571
Browse files Browse the repository at this point in the history
2 more curios and reworked shop difficulty
  • Loading branch information
db0 authored Jun 9, 2022
2 parents de184d0 + 35044a9 commit 8fbbb67
Show file tree
Hide file tree
Showing 25 changed files with 196 additions and 58 deletions.
6 changes: 3 additions & 3 deletions .gut_editor_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
"hide_orphans": false,
"ignore_pause": true,
"include_subdirs": false,
"inner_class": "TestFasterShopLevelUp",
"inner_class": "TestDoubleFusion",
"junit_xml_file": "",
"junit_xml_timestamp": false,
"log_level": 3,
"opacity": 68,
"post_run_script": "",
"pre_run_script": "",
"prefix": "test_",
"selected": "test_onceoff_artifacts.gd",
"selected": "test_journal_artifacts.gd",
"should_exit": false,
"should_exit_on_success": false,
"should_maximize": true,
Expand All @@ -33,7 +33,7 @@
"tests": [

],
"unit_test_name": null,
"unit_test_name": "test_artifact_results",
"gut_on_top": true,
"panel_options": {
"font_name": "CourierPrime",
Expand Down
Binary file added assets/icons/artifacts/tumor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions assets/icons/artifacts/tumor.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/tumor.png-616d4688c50dc63bd806ca418b892dca.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/icons/artifacts/tumor.png"
dest_files=[ "res://.import/tumor.png-616d4688c50dc63bd806ca418b892dca.stex" ]

[params]

compress/mode=1
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
1 change: 1 addition & 0 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -1050,6 +1050,7 @@ config/icon="res://icon.png"
cfc="*res://src/core/CFControl.gd"
globals="*res://src/dreamscape/Globals/Globals.gd"
SoundManager="*res://addons/sound_manager/module/SoundManager.tscn"
EventBus="*res://src/dreamscape/Globals/EventBus.gd"

[display]

Expand Down
1 change: 1 addition & 0 deletions src/dreamscape/Archetypes.gd
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ const LASER_CANNON := {
],
"Artifacts": [
ArtifactDefinitions.DoubleFirstStartup,
ArtifactDefinitions.DoubleFusion,
],
"Memories": [
MemoryDefinitions.ActivateStartups,
Expand Down
3 changes: 3 additions & 0 deletions src/dreamscape/ArtifactChoiceObject.gd
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ extends CombatSignifier
signal artifact_selected(option)
var index: int
var selected := false
var disabled := false

onready var shader_effect := $ShaderEffect
onready var bbc := $BackBufferCopy
Expand Down Expand Up @@ -51,6 +52,8 @@ func _on_JournalArtifactChoice_gui_input(event: InputEvent) -> void:
func select_self() -> void:
if selected:
return
if disabled:
return
selected = true
disconnect("gui_input", self, "_on_JournalArtifactChoice_gui_input")
disconnect("mouse_entered", self, "_on_CombatSingifier_mouse_entered")
Expand Down
24 changes: 24 additions & 0 deletions src/dreamscape/Artifacts/ArtifactDefinitions.gd
Original file line number Diff line number Diff line change
Expand Up @@ -1115,6 +1115,28 @@ const FasterRestLevelUp := {
},
}

const LightningMarble := {
"canonical_name": "LightningMarble",
"name": "Lightning Marble",
"description": "{artifact_name}: At the end of each turn turn, {attack} one random Torment for {damage_amount}.",
"icon": GENERIC_ARTIFACT_ICON,
"context": EffectContext.BATTLE,
"rarity": "Uncommon",
"amounts": {
"damage_amount": 3,
},
}


const DoubleFusion := {
"canonical_name": "DoubleFusion",
"name": "Replicator",
"description": "{artifact_name}: Whenever you draft a fusion card, gain an extra copy.",
"icon": preload("res://assets/icons/artifacts/tumor.png"),
"context": EffectContext.OVERWORLD,
"rarity": "Rare",
}


## TODO: Artifact which increases chance to find Fusion cards
## TODO. Scipt base doesn't exist yet
Expand Down Expand Up @@ -1178,6 +1200,7 @@ const GENERIC := [
FasterShopLevelUp,
FasterArtifactLevelUp,
FasterRestLevelUp,
LightningMarble,
]

# Archetype-specific artifacts which only appear in runs in which
Expand All @@ -1199,6 +1222,7 @@ const ARCHETYPE := [
DoubleFirstStartup,
ConstantImpervious,
StartingFortify,
DoubleFusion,
]

# These artifacts are only found in non-combat encounters
Expand Down
10 changes: 10 additions & 0 deletions src/dreamscape/Artifacts/DoubleFusion.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
extends Artifact

func _ready():
EventBus.connect("card_drafted",self, "_on_card_drafted")

func _on_card_drafted(drafted_card: CardEntry) -> void:
var aaa = drafted_card.properties.get("Tags", [])
if Terms.GENERIC_TAGS.fusion.name in drafted_card.properties.get("Tags", []):
globals.player.deck.add_new_card(drafted_card.card_name)
_send_trigger_signal()
21 changes: 21 additions & 0 deletions src/dreamscape/Artifacts/LightningMarble.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
extends Artifact


func _on_player_turn_ended(_turn: Turn) -> void:
var script = [
{
"name": "modify_damage",
"subject": "boardseek",
"amount": ArtifactDefinitions.LightningMarble.amounts.damage_amount,
"subject_count": 1,
"sort_by": "random",
"tags": ["Attack", "Curio"],
"filter_state_seek": [{
"filter_group": "EnemyEntities",
},],
},
]
execute_script(script)

func _on_scripting_completed(_artifact, _sceng) -> void:
_send_trigger_signal()
10 changes: 9 additions & 1 deletion src/dreamscape/Globals/DeckObject.gd
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,15 @@ func duplicate_card(card_entry: CardEntry) -> CardEntry:
func signal_card_entry_upgraded(card_entry: CardEntry) -> void:
emit_signal("card_entry_upgraded", card_entry)


func signal_card_entry_modified(card_entry: CardEntry) -> void:
emit_signal("card_entry_modified", card_entry)


func signal_card_entry_progressed(card_entry: CardEntry, amount: int) -> void:
emit_signal("card_entry_progressed", card_entry, amount)


func signal_card_entry_used(card_entry: CardEntry) -> void:
emit_signal("card_entry_used", card_entry)

Expand Down Expand Up @@ -136,6 +139,7 @@ func get_progressing_cards() -> Array:
progressing_cards.append(card_entry)
return(progressing_cards)


func get_card_needing_most_progress() -> CardEntry:
var selected_card: CardEntry
var most_progress_needed := 0
Expand All @@ -148,6 +152,7 @@ func get_card_needing_most_progress() -> CardEntry:
most_progress_needed = card_entry.upgrade_threshold - card_entry.upgrade_progress
return(selected_card)


func count_progressing_cards() -> int:
return(get_progressing_cards().size())

Expand Down Expand Up @@ -238,16 +243,19 @@ func get_random_card(card_list = cards) -> CardEntry:
CFUtils.shuffle_array(rng_array)
return(rng_array.back())


func extract_save_state() -> Array:
var deck_array := []
for ce in cards:
deck_array.append(ce.extract_save_state())
return(deck_array)


func restore_save_state(saved_cards: Array) -> void:
for ce_dict in saved_cards:
restore_card_entry(ce_dict)



func restore_card_entry(saved_entry: Dictionary) -> void:
var new_card = add_new_card(saved_entry.card_name)
new_card.restore_save_state(saved_entry)
14 changes: 7 additions & 7 deletions src/dreamscape/Globals/Difficulty.gd
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const TOTAL_DIFFICULTY_MAPS := {
0.75: 0,
1.0: -1,
},
"shop_prices": {
"mastery_difficulties": {
1.25: 1,
1.0: 0,
0.75: -1,
Expand Down Expand Up @@ -53,7 +53,7 @@ const DESCRIPTIONS := {
"starting_perturbations": "Your starting deck will get the specified amounr of random Perturbations",
"progress_increase": "The progress required to upgrade each card will be increased by this amount",
"act_healing": "At the end of each act the dreamer will release anxiety equal to this percent of their max anxiety.",
"shop_prices": "The shop prices are modified by this percentage.",
"mastery_difficulties": "The released pathos required to gain a mastery is modified by this percentage.",
"max_health": "The dreamer starting max anxiety is modified by this percentage.",
"starting_damage": "The dreamer starts with a prexisting amount of anxiety.",
"prevent_basic_cards_release": "Basic (AKA Starting) cards cannot receive an upgrade which removes them permanently from the deck.",
Expand All @@ -72,7 +72,7 @@ var total_difficulty := 0
var starting_perturbations := 0 setget set_starting_perturbations
var progress_increase := 0 setget set_progress_increase
var act_healing := 0.75 setget set_act_healing
var shop_prices := 1.0 setget set_shop_prices
var mastery_difficulties := 1.0 setget set_mastery_difficulties
var max_health := 1.0 setget set_max_health
var starting_damage := 0.0 setget set_starting_damage
var prevent_basic_cards_release := false setget set_prevent_basic_cards_release
Expand All @@ -98,9 +98,9 @@ func set_act_healing(value) -> void:
act_healing = _get_percentage_value("act_healing", value)
_finalize_value("act_healing", act_healing)

func set_shop_prices(value) -> void:
shop_prices = _get_percentage_value("shop_prices", value)
_finalize_value("shop_prices", shop_prices)
func set_mastery_difficulties(value) -> void:
mastery_difficulties = _get_percentage_value("mastery_difficulties", value)
_finalize_value("mastery_difficulties", mastery_difficulties)

func set_max_health(value) -> void:
max_health = _get_percentage_value("max_health", value)
Expand Down Expand Up @@ -168,7 +168,7 @@ func recalculate_total_difficulty() -> void:
total_difficulty += starting_perturbations
total_difficulty += progress_increase / DIFFICULTY_STEPS.progress_increase
total_difficulty += TOTAL_DIFFICULTY_MAPS.act_healing[act_healing]
total_difficulty += TOTAL_DIFFICULTY_MAPS.shop_prices[shop_prices]
total_difficulty += TOTAL_DIFFICULTY_MAPS.mastery_difficulties[mastery_difficulties]
total_difficulty += TOTAL_DIFFICULTY_MAPS.max_health[max_health]
total_difficulty += TOTAL_DIFFICULTY_MAPS.starting_damage[starting_damage]
total_difficulty += calc_boolean_difficulty(prevent_basic_cards_release)
Expand Down
4 changes: 4 additions & 0 deletions src/dreamscape/Globals/EventBus.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
extends Node

# warning-ignore:unused_signal
signal card_drafted(card_entity)
1 change: 1 addition & 0 deletions src/dreamscape/Globals/Globals.gd
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,4 @@ func clear_state_snapshot(snapshot_id) -> void:
snapshot_id)
cfc.NMAP.board.snapshot_dmg_predictions.clear()
cfc.NMAP.board.snapshot_lost_defence_predictions.clear()

25 changes: 12 additions & 13 deletions src/dreamscape/Globals/Pathos/PathosType.gd
Original file line number Diff line number Diff line change
Expand Up @@ -152,30 +152,27 @@ func level_up() -> void:


func get_progress_pct() -> float:
return(released / ((get_progression_average() * released_needed_for_level)
+ temp_modification_for_next_level + perm_modification_for_next_level)
)
return(released / get_level_requirement())


func convert_released_num_to_pct(amount: float) -> float:
return(
(amount / (get_progression_average() * released_needed_for_level))
+ temp_modification_for_next_level + perm_modification_for_next_level
)
return(amount / get_level_requirement())


func get_level_requirement() -> float:
return(
(get_progression_average() * released_needed_for_level)
+ temp_modification_for_next_level + perm_modification_for_next_level
(
get_progression_average()
* released_needed_for_level
* globals.difficulty.mastery_difficulties
)
+ temp_modification_for_next_level\
+ perm_modification_for_next_level
)


func convert_pct_to_released(pct: float) -> float:
var total = (get_progression_average() * released_needed_for_level)\
+ temp_modification_for_next_level\
+ perm_modification_for_next_level
return(total * pct)
return(get_level_requirement() * pct)


func temp_modify_requirements_for_level(amount: int) -> void:
Expand All @@ -186,6 +183,7 @@ func temp_modify_requirements_for_level(amount: int) -> void:
var normalized = 1.0 / (10.0 / get_progression_average())
temp_modification_for_next_level =\
temp_modification_for_next_level + normalized * amount
# warning-ignore:return_value_discarded
check_for_level_up()


Expand All @@ -197,6 +195,7 @@ func perm_modify_requirements_for_level(amount: int) -> void:
var normalized = 1.0 / (10.0 / get_progression_average())
perm_modification_for_next_level =\
perm_modification_for_next_level + normalized * amount
# warning-ignore:return_value_discarded
check_for_level_up()


Expand Down
14 changes: 7 additions & 7 deletions src/dreamscape/MainMenu/DifficultyMenu.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -172,23 +172,23 @@ max_value = 2.0
margin_left = 391.0
margin_right = 446.0

[node name="ShopPrices" parent="PC/VBC" instance=ExtResource( 5 )]
[node name="MasteryDifficulties" parent="PC/VBC" instance=ExtResource( 5 )]
margin_top = 445.0
margin_right = 446.0
margin_bottom = 463.0
difficulty_key = "shop_prices"
difficulty_key = "mastery_difficulties"
result_type = 1

[node name="Description" parent="PC/VBC/ShopPrices" index="0"]
text = "Shop prices"
[node name="Description" parent="PC/VBC/MasteryDifficulties" index="0"]
text = "Mastery Difficulty"

[node name="Slider" parent="PC/VBC/ShopPrices" index="1"]
[node name="Slider" parent="PC/VBC/MasteryDifficulties" index="1"]
margin_right = 387.0
min_value = -1.0
max_value = 1.0
tick_count = 3

[node name="Result" parent="PC/VBC/ShopPrices" index="2"]
[node name="Result" parent="PC/VBC/MasteryDifficulties" index="2"]
margin_left = 391.0
margin_right = 446.0

Expand Down Expand Up @@ -281,7 +281,7 @@ margin_bottom = 18.0
[editable path="PC/VBC/StartingPerturbations"]
[editable path="PC/VBC/IncreaseProgressReq"]
[editable path="PC/VBC/ActHealing"]
[editable path="PC/VBC/ShopPrices"]
[editable path="PC/VBC/MasteryDifficulties"]
[editable path="PC/VBC/MaxAnxiety"]
[editable path="PC/VBC/StartingAnxiety"]
[editable path="PC/VBC/EncounterDifficulty"]
1 change: 1 addition & 0 deletions src/dreamscape/Overworld/CardDraft.gd
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ func _on_card_draft_selected(option: int, draft_card_object) -> void:
child.queue_free()
selected_draft = globals.player.deck.add_new_card(draft_card_choices[option])
emit_signal("card_drafted", selected_draft)
EventBus.emit_signal("card_drafted", selected_draft)


func retrieve_draft_cards() -> void:
Expand Down
Loading

0 comments on commit 8fbbb67

Please sign in to comment.