From d5a2e1fcf670d87898e4e814beac9931991b64fd Mon Sep 17 00:00:00 2001 From: MacDugRPG <57243055+MacDugRPG@users.noreply.github.com> Date: Sun, 25 Sep 2022 16:46:10 -0400 Subject: [PATCH 1/3] BCR-RPG SRIS stats added with percentage ability checks This adds the ability to run percentage ability checks from the JSON module file working on the BCR-RPG SRIS ability scores taken off a new sample CSV char sheet in _userFiles. Needs heavy refactoring and cleanup still. --- ...1.csv-f11e3014c5f532cebe292d8a0c0fe994.md5 | 3 ++ ...e.csv-5f6504cbf1f30a08b14f6ec81a2ab67a.md5 | 3 ++ ...1.csv-a8d5ee41d18a2c524211a0566ead006c.md5 | 3 ++ .../_userFiles/Module_Demo_001.json | 24 +++++++-- ...estingCSVCharFile_bci-rpg_sris_test001.csv | 20 +++++++ ...SVCharFile_bci-rpg_sris_test001.csv.import | 16 ++++++ ...arFile_bci-rpg_sris_test001.en.translation | Bin 0 -> 925 bytes .../testingCSVCharFile_libre.csv | 13 +++++ .../testingCSVCharFile_libre.csv.import | 16 ++++++ .../testingCSVCharFile_libre.en.translation | Bin 0 -> 709 bytes .../testingCSVCharFile_rolemaster_test001.csv | 14 +++++ ...gCSVCharFile_rolemaster_test001.csv.import | 16 ++++++ ...CharFile_rolemaster_test001.en.translation | Bin 0 -> 761 bytes .../gamePlay/Game.gd | 35 ++++++++++++- .../globalScripts/DieManager.gd | 2 - .../globalScripts/playerCharacterTemplate.gd | 49 ++++++++++++++++++ .../screens/ImportCharacter.gd | 44 ++++++++++++++++ .../screens/ImportCharacter.tscn | 5 +- 18 files changed, 252 insertions(+), 11 deletions(-) create mode 100644 Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/.import/testingCSVCharFile_bci-rpg_sris_test001.csv-f11e3014c5f532cebe292d8a0c0fe994.md5 create mode 100644 Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/.import/testingCSVCharFile_libre.csv-5f6504cbf1f30a08b14f6ec81a2ab67a.md5 create mode 100644 Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/.import/testingCSVCharFile_rolemaster_test001.csv-a8d5ee41d18a2c524211a0566ead006c.md5 create mode 100644 Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/_userFiles/characterFiles/testingCSVCharFile_bci-rpg_sris_test001.csv create mode 100644 Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/_userFiles/characterFiles/testingCSVCharFile_bci-rpg_sris_test001.csv.import create mode 100644 Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/_userFiles/characterFiles/testingCSVCharFile_bci-rpg_sris_test001.en.translation create mode 100644 Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/_userFiles/characterFiles/testingCSVCharFile_libre.csv create mode 100644 Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/_userFiles/characterFiles/testingCSVCharFile_libre.csv.import create mode 100644 Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/_userFiles/characterFiles/testingCSVCharFile_libre.en.translation create mode 100644 Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/_userFiles/characterFiles/testingCSVCharFile_rolemaster_test001.csv create mode 100644 Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/_userFiles/characterFiles/testingCSVCharFile_rolemaster_test001.csv.import create mode 100644 Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/_userFiles/characterFiles/testingCSVCharFile_rolemaster_test001.en.translation diff --git a/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/.import/testingCSVCharFile_bci-rpg_sris_test001.csv-f11e3014c5f532cebe292d8a0c0fe994.md5 b/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/.import/testingCSVCharFile_bci-rpg_sris_test001.csv-f11e3014c5f532cebe292d8a0c0fe994.md5 new file mode 100644 index 0000000..24bdfa0 --- /dev/null +++ b/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/.import/testingCSVCharFile_bci-rpg_sris_test001.csv-f11e3014c5f532cebe292d8a0c0fe994.md5 @@ -0,0 +1,3 @@ +source_md5="b918ce36c79140123ba6299230647b74" +dest_md5="4a3acb68f07fc2d17b50af0660f3c0ca" + diff --git a/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/.import/testingCSVCharFile_libre.csv-5f6504cbf1f30a08b14f6ec81a2ab67a.md5 b/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/.import/testingCSVCharFile_libre.csv-5f6504cbf1f30a08b14f6ec81a2ab67a.md5 new file mode 100644 index 0000000..e7eb9da --- /dev/null +++ b/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/.import/testingCSVCharFile_libre.csv-5f6504cbf1f30a08b14f6ec81a2ab67a.md5 @@ -0,0 +1,3 @@ +source_md5="dd2844f8b96c7a7f955098cd2ce51510" +dest_md5="deb4ac7c88acaaec693aea232ca4b9e5" + diff --git a/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/.import/testingCSVCharFile_rolemaster_test001.csv-a8d5ee41d18a2c524211a0566ead006c.md5 b/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/.import/testingCSVCharFile_rolemaster_test001.csv-a8d5ee41d18a2c524211a0566ead006c.md5 new file mode 100644 index 0000000..f657c1a --- /dev/null +++ b/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/.import/testingCSVCharFile_rolemaster_test001.csv-a8d5ee41d18a2c524211a0566ead006c.md5 @@ -0,0 +1,3 @@ +source_md5="766d733b8edaa28cdf98e68e20ceba59" +dest_md5="e416e3ec46373a873cfc4afbf066c70f" + diff --git a/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/_userFiles/Module_Demo_001.json b/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/_userFiles/Module_Demo_001.json index c0247bc..1964347 100644 --- a/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/_userFiles/Module_Demo_001.json +++ b/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/_userFiles/Module_Demo_001.json @@ -12,8 +12,8 @@ "Action":"ShowText", "A_Params":"", "Text":"The boat rocks gently. You can leave the boat through a hatch. There is also now a test option.", - "Option_Labels":["Examine Ship","Climb out through hatch","Play the fiddle!","Rest","Meditate", "Run die roll test"], - "Option_GoTos":["Boat_002","Shore_001","Misc_001","Misc_002","Misc_003","Test_000"] + "Option_Labels":["Examine Ship","Climb out through hatch","Play the fiddle!","Rest","Meditate", "Run generic die roll test", "Do strength check on percentile die"], + "Option_GoTos":["Boat_002","Shore_001","Misc_001","Misc_002","Misc_003","Test_000","Test_002"] }, "Node_Boat_002":{ "Id":"Boat_002", @@ -67,8 +67,24 @@ "Id":"Test_001", "Action":"TestHandleNodeParams", "A_Params":"", - "Text":"Die were rolled and passed to this node as: ", + "Text":"Dice were rolled and passed to this node as: ", "Option_Labels":["Back to boat"], "Option_GoTos":["Boat_001"] - } + }, + "Node_Test002":{ + "Id":"Test_002", + "Action":"RollDice", + "A_Params":[10,10], + "Text":"Dice were rolled and passed to this node as: ", + "Option_Labels":["NA"], + "Option_GoTos":["Test_003"] + }, + "Node_Test003":{ + "Id":"Test_003", + "Action":"TestAbstractAbilityCheck", + "A_Params":["ST"], + "Text":"Ability check run on strength resulted in: ", + "Option_Labels":["Back to boat"], + "Option_GoTos":["Boat_001"] + } } \ No newline at end of file diff --git a/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/_userFiles/characterFiles/testingCSVCharFile_bci-rpg_sris_test001.csv b/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/_userFiles/characterFiles/testingCSVCharFile_bci-rpg_sris_test001.csv new file mode 100644 index 0000000..a4c1e48 --- /dev/null +++ b/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/_userFiles/characterFiles/testingCSVCharFile_bci-rpg_sris_test001.csv @@ -0,0 +1,20 @@ +keys,en +Name,Jon +Race,Person +Class,CSV +AG,65 +APP,50 +CO,55 +QU,55 +MD,60 +ST,60 +CH,72 +EM,45 +IN,50 +ME,40 +MX,55 +PR,55 +RE,30 +SD,25 +Weapon,Mighty Pen +Armor,Sweater vest +1 diff --git a/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/_userFiles/characterFiles/testingCSVCharFile_bci-rpg_sris_test001.csv.import b/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/_userFiles/characterFiles/testingCSVCharFile_bci-rpg_sris_test001.csv.import new file mode 100644 index 0000000..aa62394 --- /dev/null +++ b/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/_userFiles/characterFiles/testingCSVCharFile_bci-rpg_sris_test001.csv.import @@ -0,0 +1,16 @@ +[remap] + +importer="csv_translation" +type="Translation" + +[deps] + +files=[ "res://_userFiles/characterFiles/testingCSVCharFile_bci-rpg_sris_test001.en.translation" ] + +source_file="res://_userFiles/characterFiles/testingCSVCharFile_bci-rpg_sris_test001.csv" +dest_files=[ "res://_userFiles/characterFiles/testingCSVCharFile_bci-rpg_sris_test001.en.translation" ] + +[params] + +compress=true +delimiter=0 diff --git a/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/_userFiles/characterFiles/testingCSVCharFile_bci-rpg_sris_test001.en.translation b/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/_userFiles/characterFiles/testingCSVCharFile_bci-rpg_sris_test001.en.translation new file mode 100644 index 0000000000000000000000000000000000000000..8a59fa49dd367059067b9c74c28b84eff4738451 GIT binary patch literal 925 zcmbVL%Ss$U6uqfv5)%yuLgGTqFdzs9=Vec#hy#&`#0TSyaV3mBO)=ACrdzvOA=~%` zZt@EOU5K9$(M2GeY_bRhL2=<@kuQjzJE;n_n3YAJKKGu!kE+|xLflBWcC4(RN+SC$x0*i+(so1E6S6Bq{sHNz->zEg3^>qxizWi zKAcvDq(?C8*j*)ds|`s#aH|{M2N`RDJE=JGgWA6|bZ^s6WjTKe?)_kA8XzdD|!iF=JcJTudO66eZWzS(C1 z`fMBhWMJ#tTT3@}JJ6rMFH`sPfmnk3-#2yFuQoq%41Zw^qpx0w=9m?K5B3XS5y+)! z-mlf;kBOoTDC^MQ^7h$mI8WDNI73AlDf~S7G>tm+4%Sq8neq+`PMTh2$#Gg2T!%(m KchoH5$Gicw7MC0V literal 0 HcmV?d00001 diff --git a/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/_userFiles/characterFiles/testingCSVCharFile_libre.csv b/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/_userFiles/characterFiles/testingCSVCharFile_libre.csv new file mode 100644 index 0000000..b2a1b5a --- /dev/null +++ b/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/_userFiles/characterFiles/testingCSVCharFile_libre.csv @@ -0,0 +1,13 @@ +keys,en +Name,The Epic Test +Race,Robot +Class,CSV +Str,16 +Int,19 +Wis,3 +Dex,10 +Con,11 +Chr,8 +HP,72 +Weapon,Comma + 2 +Armor,Obfuscating shield diff --git a/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/_userFiles/characterFiles/testingCSVCharFile_libre.csv.import b/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/_userFiles/characterFiles/testingCSVCharFile_libre.csv.import new file mode 100644 index 0000000..5605262 --- /dev/null +++ b/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/_userFiles/characterFiles/testingCSVCharFile_libre.csv.import @@ -0,0 +1,16 @@ +[remap] + +importer="csv_translation" +type="Translation" + +[deps] + +files=[ "res://_userFiles/characterFiles/testingCSVCharFile_libre.en.translation" ] + +source_file="res://_userFiles/characterFiles/testingCSVCharFile_libre.csv" +dest_files=[ "res://_userFiles/characterFiles/testingCSVCharFile_libre.en.translation" ] + +[params] + +compress=true +delimiter=0 diff --git a/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/_userFiles/characterFiles/testingCSVCharFile_libre.en.translation b/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/_userFiles/characterFiles/testingCSVCharFile_libre.en.translation new file mode 100644 index 0000000000000000000000000000000000000000..408bcb645ae73cd1d654b3429a834e6443400e8d GIT binary patch literal 709 zcmbV~O(;ZB6vq$aa}1HvhOBG zDN9+}D6$kQWv9pgjJfral~cdYJ^wrB>&}bCV-d<(0A5jr^K{gZE3=Ma$+Y37Y)k#_ z-@XKyVc-a9Z#bq%q;1nkCtN!rO<@VD@ZVWRMo=k~jF8e;7Ltk)WHSVn;kbh760VU< z3o1vL+%Q*#n-jQ`be)v7{F5e4C$;86B+3IpkgYV_)umI2CD@-k^Me!s4R9N_BEWkz zfG?jlBW?rTVAyw8h_ePp0rz5BJ6~_$vNd^c?!o%R%k6m|JZsh9@_PS)>#9E{da(Ph z`{KietaUP2N{R=UEx0hfWtCYZ2$?Q2O3$zQy~gK1x4sTAR_J^Lz~F@!k5{ z=5`A_KP7V&-}>P9_+9s`dG5Iex~j{wG=eb@C2xFWhrHSTfJXy86tk1IOL{-`lCIMr lMdEX$4^hOmj|Hys7z)qxw5DxO5TrP$Py9_#5ZLd*%QD literal 0 HcmV?d00001 diff --git a/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/_userFiles/characterFiles/testingCSVCharFile_rolemaster_test001.csv b/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/_userFiles/characterFiles/testingCSVCharFile_rolemaster_test001.csv new file mode 100644 index 0000000..9e012c3 --- /dev/null +++ b/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/_userFiles/characterFiles/testingCSVCharFile_rolemaster_test001.csv @@ -0,0 +1,14 @@ +keys,en +Name,Jon +Race,Person +Class,CSV +ST,55 +QU,35 +PR,50 +IN,35 +EM,35 +CO,65 +AG,55 +SD,75 +ME,25 +RE,40 diff --git a/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/_userFiles/characterFiles/testingCSVCharFile_rolemaster_test001.csv.import b/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/_userFiles/characterFiles/testingCSVCharFile_rolemaster_test001.csv.import new file mode 100644 index 0000000..79be6ea --- /dev/null +++ b/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/_userFiles/characterFiles/testingCSVCharFile_rolemaster_test001.csv.import @@ -0,0 +1,16 @@ +[remap] + +importer="csv_translation" +type="Translation" + +[deps] + +files=[ "res://_userFiles/characterFiles/testingCSVCharFile_rolemaster_test001.en.translation" ] + +source_file="res://_userFiles/characterFiles/testingCSVCharFile_rolemaster_test001.csv" +dest_files=[ "res://_userFiles/characterFiles/testingCSVCharFile_rolemaster_test001.en.translation" ] + +[params] + +compress=true +delimiter=0 diff --git a/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/_userFiles/characterFiles/testingCSVCharFile_rolemaster_test001.en.translation b/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/_userFiles/characterFiles/testingCSVCharFile_rolemaster_test001.en.translation new file mode 100644 index 0000000000000000000000000000000000000000..d234c1e45846ec0301c861afbfac26d6a7b00fe7 GIT binary patch literal 761 zcmbVK%Sr=55NyZzexTqB6pbP(q9!J;ikE=71P>CEnCrS(h9sEm#+}Wt_zQv_{01d{ zfEN#fc<`nd|3Itbjx3Us14VV$R`>MGPA;EIQ?R^TjsobV#OS9(MR?YNXQ`ypyG#dWqSanGQQ0h`Ct1K1uA!%1g8bVmXbf#~WYLZ5f zmYVjt^aFu+QodJp%0Few_NomZB2gDG2(&vL#A4et%o0||GxLQ+fG98x@cP2y7R+Pd zsUV&Ucm=!>#Oz6gV$S#fj9!b1`q(xm28Pq(C?4Ac@RbYlbG4VxPCo;;+go8 z7+SwtYMk)F_zVoKKfVaLj$HTB`=y?RJs;B7wmw?DL2bDH_DximLq6Si;!flzJLsuT zaWNax^?nif`Az6KF7HKQF_i1RXYZoE8q#^D1z;0M8f3)j2ro1%Jq1eVi)0wIXHdeR RU4wSw>|vV$JLT}`zX9#PjAsA< literal 0 HcmV?d00001 diff --git a/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/gamePlay/Game.gd b/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/gamePlay/Game.gd index e5bd203..ff11f76 100644 --- a/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/gamePlay/Game.gd +++ b/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/gamePlay/Game.gd @@ -157,6 +157,31 @@ func change_node(destinationNode: String, destinationParams: Array = []) -> void var destArr = target_Locale.destinations_array create_option(option, destArr[i]) i = i+1 + #DKM TEMP: running an ability check test on passed node: -- this is only built out for agility and strength in this test + # Def needs all kinds of refactor + elif target_Locale.locale_action == "TestAbstractAbilityCheck": + var check_result ="NA" + print("DKM TEMP: passed stat is :" +target_Locale.locale_action_params[0]) + if(target_Locale.locale_action_params[0] in pSingleton.pc.viableCharStats): + match target_Locale.locale_action_params[0]: + "AG": + if(int(destinationParams[0])<= pSingleton.pc.agility): + check_result = "PASS" + else: + check_result = "FAIL" + "ST": + if(int(destinationParams[0])<= pSingleton.pc.strength): + check_result = "PASS" + else: + check_result = "FAIL" + + create_response(target_Locale.locale_description + check_result + " with roll of: " + str(destinationParams) + "; on ability of: " + str(pSingleton.pc.strength)) + clear_prior_options() + var i = 0 + for option in target_Locale.options_array: + var destArr = target_Locale.destinations_array + create_option(option, destArr[i]) + i = i+1 options_container.get_child(0).grab_focus() func action_show_text(newLocale: Locale) -> void: @@ -181,7 +206,14 @@ func action_roll_die(newLocale: Locale) -> void: DiceRoller.dieManager.setDieManager(dieParams, 0.5) var result = DiceRoller.dieManager.rollDice() print("Rolled values: " + str(result[0])) - + if(DiceRoller.dieManager.isPercentageRoll): + var percDie = int(result[1]*100) + print("DKM TEMP: is percentage roll and perc res is: " + str(percDie)) + var perc_result = [percDie] + change_node(newLocale.destinations_array[0], perc_result) + else: + change_node(newLocale.destinations_array[0], result[0]) + #DKM TEMP: Andrew's code for ref: #assigning variable names to each of them for better clarity # var rolledValues = result[0] @@ -190,7 +222,6 @@ func action_roll_die(newLocale: Locale) -> void: # var neededPercent = result[3] # var degreeOfSuccess = result[4] # var dice = result[5] - change_node(newLocale.destinations_array[0], result[0]) #DKM TEMP: saves the entire scene in one packed scene file func save_module(): diff --git a/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/globalScripts/DieManager.gd b/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/globalScripts/DieManager.gd index 6579982..4605559 100644 --- a/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/globalScripts/DieManager.gd +++ b/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/globalScripts/DieManager.gd @@ -96,8 +96,6 @@ func rollDice(): if isPercentageRoll: sumOfPercentages += (returnDiePercentage(diceUsed[0]) / 10.0) + (returnDiePercentage(diceUsed[1]) / 100.0) else: - #DKM TEMP: not percentage roll: - print("TEMP: not percentage roll") for die in diceUsed: sumOfPercentages += returnDiePercentage(die) denominator += 1 diff --git a/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/globalScripts/playerCharacterTemplate.gd b/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/globalScripts/playerCharacterTemplate.gd index a8665ce..1e3619e 100644 --- a/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/globalScripts/playerCharacterTemplate.gd +++ b/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/globalScripts/playerCharacterTemplate.gd @@ -6,3 +6,52 @@ extends Resource class_name playerCharacterTemplate var pcText = "" + +#BCO-RPG SRIS system (percentile): +var viableCharStats = ["AG", +"APP", +"CO", +"QU", +"MD", +"ST", +"CH", +"EM", +"IN", +"ME", +"MX", +"PR", +"RE", +"SD"] + +var agility = 0 +var appearance = 0 +var constitution = 0 +var quickness = 0 +var manual_dexterity = 0 +var strength = 0 +var chutzpah = 0 +var empathy = 0 +var intuition = 0 +var memory = 0 +var moxie = 0 +var presence = 0 +var reasoning = 0 +var self_discipline = 0 + +func toString() -> String: + return("pcText: " + str(pcText) + + "; Agility: " + str(agility) + + "; Appearance: " + str(appearance) + + "; Constitution: " + str(constitution) + + "; Quickness: " + str(quickness) + + "; Manual_dexterity: " + str(manual_dexterity) + + "; Strength: " + str(strength) + + "; Chutzpah: " + str(chutzpah) + + "; Empathy: " + str(empathy) + + "; Intuition: " + str(intuition) + + "; Memory: " + str(memory) + + "; Moxie: " + str(moxie) + + "; Presence: " + str(presence) + + "; Reasoning: " + str(reasoning) + + "; Self_discipline: " + str(self_discipline) + ) diff --git a/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/screens/ImportCharacter.gd b/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/screens/ImportCharacter.gd index 3a17978..a2fe010 100644 --- a/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/screens/ImportCharacter.gd +++ b/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/screens/ImportCharacter.gd @@ -15,6 +15,41 @@ func _ready() -> void: func _on_Button_pressed(): $FileDialog.popup() + +#Import character file +func _charSetStat(statname: String, statvalue: int) -> void: + if statname in pSingleton.viableCharStats: + match statname: + "AG": + pSingleton.agility = statvalue + "APP": + pSingleton.appearance = statvalue + "CO": + pSingleton.constitution = statvalue + "QU": + pSingleton.quickness = statvalue + "MD": + pSingleton.manual_dexterity = statvalue + "ST": + pSingleton.strength = statvalue + "CH": + pSingleton.chutzpah = statvalue + "EM": + pSingleton.empathy = statvalue + "IN": + pSingleton.intuition = statvalue + "ME": + pSingleton.memory = statvalue + "MX": + pSingleton.moxie = statvalue + "PR": + pSingleton.presence = statvalue + "RE": + pSingleton.reasoning = statvalue + "SD": + pSingleton.self_discipline = statvalue + else: + return #this is going to take information from the file the player chose and put the individul parts into textboxes so it can be edited and then saved func _on_FileDialog_file_selected(path): @@ -27,6 +62,8 @@ func _on_FileDialog_file_selected(path): var csvStrArray = file.get_csv_line() var i = 0 var isLabel = true + var row_label = "" + var row_value = "" while i < csvStrArray.size(): var csvStr = csvStrArray[i] if(isLabel): @@ -34,10 +71,14 @@ func _on_FileDialog_file_selected(path): var textLine = Label.new() $ScrollContainer/VBoxContainer.add_child(textLine) textLine.text = csvStr.to_upper() + row_label = csvStr.to_upper() isLabel = false #DKM TEMP: save this unformatted to the singleton text string pSingleton.pcText += csvStr.to_upper() + ": " else: + row_value = csvStr + if(typeof(int(row_value)) == TYPE_INT): + _charSetStat(row_label, int(row_value)) isLabel = true var textBox = LineEdit.new() $ScrollContainer/VBoxContainer.add_child(textBox) @@ -46,3 +87,6 @@ func _on_FileDialog_file_selected(path): pSingleton.pcText += csvStr + "\n" i += 1 file.close() + #DKM TEMP: + print("PRINTING set char tostring: ") + print(pSingleton.toString()) diff --git a/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/screens/ImportCharacter.tscn b/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/screens/ImportCharacter.tscn index 3ba6357..f6e11f6 100644 --- a/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/screens/ImportCharacter.tscn +++ b/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/screens/ImportCharacter.tscn @@ -37,9 +37,8 @@ margin_bottom = 480.0 window_title = "Open a File" mode = 0 access = 2 -current_dir = "/ProgramData/CS_Working/RPGR/Godot_projects/bcirpg_mergedDemo_20220911A" -current_file = "_userData/characterFiles" -current_path = "/ProgramData/CS_Working/RPGR/Godot_projects/bcirpg_mergedDemo_20220911A/_userData/characterFiles" +current_dir = "/ProgramData/CS_Working/RPGR/Godot_projects/bcirpg_mergedMaster_20220918A" +current_path = "/ProgramData/CS_Working/RPGR/Godot_projects/bcirpg_mergedMaster_20220918A/" __meta__ = { "_edit_use_anchors_": false } From b31d6cb5f4648aeab789f46a7052f7b59de89cc2 Mon Sep 17 00:00:00 2001 From: MacDugRPG <57243055+MacDugRPG@users.noreply.github.com> Date: Sun, 2 Oct 2022 15:34:03 -0400 Subject: [PATCH 2/3] Cleanup Misc cleanup and game script refactoring --- .../gamePlay/Game.gd | 184 +++++++++--------- 1 file changed, 88 insertions(+), 96 deletions(-) diff --git a/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/gamePlay/Game.gd b/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/gamePlay/Game.gd index ff11f76..57d4736 100644 --- a/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/gamePlay/Game.gd +++ b/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918A/gamePlay/Game.gd @@ -4,7 +4,7 @@ extends Control -#Source for module file: to the GU +#Source for module file: #export(String, FILE, "*.json") var module_file_path:String #DKM TEMP: var module_file_path = "res://_userFiles/Module_Demo_001.json" @@ -22,24 +22,20 @@ onready var options_container = $Background/MarginContainer/Rows/InputArea/Scrol onready var pSingleton = get_node("/root/PlayerCharacter") onready var charSheet = $Con_charSheet/MarginContainer/VBoxContainer/CharacterSheet - -#DKM TEMP: this is just a temp file solution for grabbing map/module, will be replaced with DB -# or desired load approach -onready var module_map = "res://_userFiles/temp_map.save" - var nodeArray func _ready() -> void: - save_module() theme=load(settings.themeFile) + #Initialize module and display text: + load_new_module() + current_text.show() + #Load character sheet: + charSheet.text = pSingleton.pc.pcText - #DKM TEMP: testing: - var moduleDict = loadJSONToDict(module_file_path) - - #DKM TEMP: this needs to be refactored to reposition this initialization +#Initializes the default module: +func load_new_module() -> void: + var moduleDict = load_JSON_to_dict(module_file_path) var i = 0 - #print("Looking for JSON at: " + module_file_path) - #print("Json returned as: " + str(moduleDict)) var initialNode = Locale.new() nodeArray = [initialNode] for moduleNode in moduleDict.values(): @@ -62,14 +58,8 @@ func _ready() -> void: #print("For #" + str(i) + ": appended go to destination of: " + str(dest)) #print("Node array name for #" + str(i) + ": " + nodeArray[i].locale_name) i = i+1 - - current_text.show() - - #Load character sheet: - charSheet.text = pSingleton.pc.pcText - create_response(nodeArray[0].locale_description) - #DKM TEMP: another that needs to be broken out when ready: + clear_prior_options() i = 0 for option in nodeArray[0].options_array: @@ -78,17 +68,28 @@ func _ready() -> void: i = i+1 options_container.get_child(0).grab_focus() -#DKM TEMP: convert JSON file to dictionary for module import: -func loadJSONToDict(filepath:String)->Dictionary: - var file = File.new() - #assert file.file_exists(filepath) - file.open(filepath,file.READ) - var moduleDict = parse_json(file.get_as_text()) - #assert moduleDict.size() > 0 - return moduleDict +#Master method for handling user interaction: +func change_node(destinationNode: String, destinationParams: Array = []) -> void: + var target_Locale = get_node_by_name(destinationNode) + #Run provided action: + if target_Locale.locale_action == "ShowText": + action_show_text(target_Locale) + elif target_Locale.locale_action == "RollDice" && target_Locale.destinations_array.size() == 1: + action_roll_die(target_Locale) + #DKM TEMP: testing passed param handling by node to node + elif target_Locale.locale_action == "TestHandleNodeParams": + action_handle_node_params_testing(target_Locale, destinationParams) + #DKM TEMP: running an ability check test on passed node: + elif target_Locale.locale_action == "TestAbstractAbilityCheck": + action_ability_check_testing(target_Locale, destinationParams) + + options_container.get_child(0).grab_focus() -#Handles input text +#################################################### +#DISPLAY METHODS: +# Handles output text and options +#################################################### func create_response(response_text: String): var response = TextOutput.instance() response.text = response_text @@ -103,11 +104,7 @@ func add_response_to_game(response: Control): current_text.add_child(response) func add_response_to_history(response: Control) -> void: - #DKM TEMP: so here we - #1. var response_history = response.duplicate() var response_for_history = response.duplicate() - #2. get the history array from the singleton, - #3. Add this to the history array history_source.output_history_array.append(response_for_history) func clear_prior_options() -> void: @@ -129,61 +126,15 @@ func add_option_to_game(optionNew: Control) -> void: #print("New added opt is: " + str(newOptNumber-1)) options_container.get_child(newOptNumber-1).connect("option_pressed", self, "_on_option_pressed") -#DKM TEMP: these need to be dynamically added with the options themselves - func _on_option_pressed(destinationSelected: String) -> void: #print("Destination node for pressed option is: " + destinationSelected) change_node(destinationSelected) - -func get_node_by_name(nodeName: String) -> Locale: - for n in nodeArray: - if n.locale_name == nodeName: - return n - return nodeArray[0] -func change_node(destinationNode: String, destinationParams: Array = []) -> void: - var target_Locale = get_node_by_name(destinationNode) - #Run provided action: - if target_Locale.locale_action == "ShowText": - action_show_text(target_Locale) - elif target_Locale.locale_action == "RollDice" && target_Locale.destinations_array.size() == 1: - action_roll_die(target_Locale) - #DKM TEMP: testing passed param handling by node to node - elif target_Locale.locale_action == "TestHandleNodeParams": - create_response(target_Locale.locale_description + str(destinationParams)) - clear_prior_options() - var i = 0 - for option in target_Locale.options_array: - var destArr = target_Locale.destinations_array - create_option(option, destArr[i]) - i = i+1 - #DKM TEMP: running an ability check test on passed node: -- this is only built out for agility and strength in this test - # Def needs all kinds of refactor - elif target_Locale.locale_action == "TestAbstractAbilityCheck": - var check_result ="NA" - print("DKM TEMP: passed stat is :" +target_Locale.locale_action_params[0]) - if(target_Locale.locale_action_params[0] in pSingleton.pc.viableCharStats): - match target_Locale.locale_action_params[0]: - "AG": - if(int(destinationParams[0])<= pSingleton.pc.agility): - check_result = "PASS" - else: - check_result = "FAIL" - "ST": - if(int(destinationParams[0])<= pSingleton.pc.strength): - check_result = "PASS" - else: - check_result = "FAIL" - - create_response(target_Locale.locale_description + check_result + " with roll of: " + str(destinationParams) + "; on ability of: " + str(pSingleton.pc.strength)) - clear_prior_options() - var i = 0 - for option in target_Locale.options_array: - var destArr = target_Locale.destinations_array - create_option(option, destArr[i]) - i = i+1 - options_container.get_child(0).grab_focus() +#################################################### +#ACTION HANDLERS: +# Process actions from selected nodes +#################################################### func action_show_text(newLocale: Locale) -> void: create_response(newLocale.locale_description) clear_prior_options() @@ -214,17 +165,58 @@ func action_roll_die(newLocale: Locale) -> void: else: change_node(newLocale.destinations_array[0], result[0]) - #DKM TEMP: Andrew's code for ref: - #assigning variable names to each of them for better clarity -# var rolledValues = result[0] -# var percentRolled = result[1] -# var passResult = result[2] -# var neededPercent = result[3] -# var degreeOfSuccess = result[4] -# var dice = result[5] -#DKM TEMP: saves the entire scene in one packed scene file -func save_module(): - var scene = PackedScene.new() - scene.pack(self) - ResourceSaver.save("user://game_01.tscn", scene) +#TESTING ACTIONS: +#Test version of ability check -- only built our for strength and agility with this output +func action_ability_check_testing(t_Locale: Locale, d_Params: Array = []) -> void: + var check_result ="NA" + print("Testing: passed stat is :" +t_Locale.locale_action_params[0]) + if(t_Locale.locale_action_params[0] in pSingleton.pc.viableCharStats): + match t_Locale.locale_action_params[0]: + "AG": + if(int(d_Params[0])<= pSingleton.pc.agility): + check_result = "PASS" + else: + check_result = "FAIL" + "ST": + if(int(d_Params[0])<= pSingleton.pc.strength): + check_result = "PASS" + else: + check_result = "FAIL" + + create_response(t_Locale.locale_description + check_result + " with roll of: " + str(d_Params) + "; on ability of: " + str(pSingleton.pc.strength)) + clear_prior_options() + var i = 0 + for option in t_Locale.options_array: + var destArr = t_Locale.destinations_array + create_option(option, destArr[i]) + i = i+1 + +func action_handle_node_params_testing(t_Locale: Locale, d_Params: Array = []) -> void: + create_response(t_Locale.locale_description + str(d_Params)) + clear_prior_options() + var i = 0 + for option in t_Locale.options_array: + var destArr = t_Locale.destinations_array + create_option(option, destArr[i]) + i = i+1 + +#################################################### +#HELPER METHODS: +#################################################### +func get_node_by_name(nodeName: String) -> Locale: + for n in nodeArray: + if n.locale_name == nodeName: + return n + return nodeArray[0] + +#Convert JSON file to dictionary for module import: +# DKM TEMP: JSON only for development work -- will come from alt data source +func load_JSON_to_dict(filepath:String)->Dictionary: + var file = File.new() + #assert file.file_exists(filepath) + file.open(filepath,file.READ) + var moduleDict = parse_json(file.get_as_text()) + #assert moduleDict.size() > 0 + return moduleDict + From 47a0a46b5b861f0047eb48cf9994e3978aa3ebda Mon Sep 17 00:00:00 2001 From: PersonGuyGit Date: Sun, 16 Oct 2022 12:52:23 -0600 Subject: [PATCH 3/3] Worked with doug to figure out how to use Mode 2 of the File Dialog Class --- .../screens/Character_Add.gd | 38 +++++++------------ .../screens/MenuScreen.tscn | 3 -- 2 files changed, 14 insertions(+), 27 deletions(-) diff --git a/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918ALuke/screens/Character_Add.gd b/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918ALuke/screens/Character_Add.gd index 9b034ab..6585cc0 100644 --- a/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918ALuke/screens/Character_Add.gd +++ b/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918ALuke/screens/Character_Add.gd @@ -9,7 +9,6 @@ var rows onready var settings = get_node("/root/GlobalSaveInstance").settingsInstance onready var SaveButton = get_node("HBoxContainer/VBoxContainer/SaveButton") - onready var nameVar = get_node("HBoxContainer/VBoxContainer/LabelName/LineEditName") onready var profVar = get_node("HBoxContainer/VBoxContainer/LabelProfession/LineEditProf") onready var strengthVar = get_node("HBoxContainer/VBoxContainer/LabelStrength/LineEditStrength") @@ -20,38 +19,29 @@ onready var weaponVar = get_node("HBoxContainer/VBoxContainer2/LabelWeapon/LineE onready var armorVar = get_node("HBoxContainer/VBoxContainer2/LabelArmor/LineEditArmor") onready var quoteVar = get_node("HBoxContainer/VBoxContainer2/LabelQuote/LineEditQuote") -func writeToCSV(nameV, profV, strengthV, intelV, willpowerV, charmV, weaponV, armorV, quoteV): - var f = File.new() - f.open("res://_userFiles/CharacterOutput.csv", File.WRITE) - var ArrayStrings = [PoolStringArray()] - - f.store_csv_line(["Name", nameV]) - f.store_csv_line(["Profession", profV]) - f.store_csv_line(["Strength", strengthV]) - f.store_csv_line(["Intellegence", intelV]) - f.store_csv_line(["Willpower", willpowerV]) - f.store_csv_line(["Charm", charmV]) - f.store_csv_line(["Weapon", weaponV]) - f.store_csv_line(["Armor", armorV]) - f.store_csv_line(["Quote", quoteV]) - f.close() - - func _process(delta): if SaveButton.pressed == true: $Title/FileDialog.popup() - writeToCSV(nameVar.get_text(), profVar.get_text(), - strengthVar.get_text(), intelVar.get_text(), willpowerVar.get_text(), - charmVar.get_text(), weaponVar.get_text(), armorVar.get_text(), quoteVar.get_text()) - func _ready() -> void: theme=load(settings.themeFile) #DKM TEMP: just text for now from text edit func _on_FileDialog_file_selected(path: String) -> void: var pc = get_node("/root/PlayerCharacter") + var newCharFile = File.new() newCharFile.open(path, 2) - newCharFile.store_string($TextEdit.text) - pc.playerCharacterSingleton.pcText = $TextEdit.text + var f = File.new() + + f.store_csv_line(["Name", nameVar.get_text()]) + f.store_csv_line(["Profession", profVar.get_text()]) + f.store_csv_line(["Strength", strengthVar.get_text()]) + f.store_csv_line(["Intellegence", intelVar.get_text()]) + f.store_csv_line(["Willpower", willpowerVar.get_text()]) + f.store_csv_line(["Charm", charmVar.get_text()]) + f.store_csv_line(["Weapon", weaponVar.get_text()]) + f.store_csv_line(["Armor", armorVar.get_text()]) + f.store_csv_line(["Quote", quoteVar.get_text()]) + f.close() + diff --git a/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918ALuke/screens/MenuScreen.tscn b/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918ALuke/screens/MenuScreen.tscn index e5b43a5..a65cd37 100644 --- a/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918ALuke/screens/MenuScreen.tscn +++ b/Phase2/Godot ===(Game Code)===/MergedMaster/bcirpg_mergedMaster_20220918ALuke/screens/MenuScreen.tscn @@ -12,9 +12,6 @@ anchor_right = 1.0 anchor_bottom = 1.0 theme = ExtResource( 6 ) script = ExtResource( 2 ) -__meta__ = { -"_edit_use_anchors_": false -} [node name="Background" type="Panel" parent="."] anchor_right = 1.0