diff --git a/PartyViewer.tscn b/PartyViewer.tscn index c8b14aca..affa529e 100644 --- a/PartyViewer.tscn +++ b/PartyViewer.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=36 format=2] +[gd_scene load_steps=38 format=2] [ext_resource path="res://PanelTheme.tres" type="Theme" id=1] [ext_resource path="res://fonts/Essentiarum Regular.ttf" type="DynamicFontData" id=2] @@ -20,6 +20,9 @@ onready var member3 = $Members/Member3 onready var member4 = $Members/Member4 onready var member5 = $Members/Member5 onready var member6 = $Members/Member6 +var data_translate = load(\"res://scripts/Pokemon_Database.gd\").new() +var current_party = [] +var selected_types = [null,null] enum types { NULL, NORMAL, @@ -145,12 +148,14 @@ func setMember(spot,member): moves -= 1 func showParty(party): + current_party = party var member = Pokemon.pokemon[party[0]] for child in $Members.get_children(): child.visible = false var member_pos = 0 while member_pos < party.size(): if party[member_pos] == null: + member_pos += 1 continue member = Pokemon.pokemon[party[member_pos]] match member_pos: @@ -173,11 +178,217 @@ func showParty(party): setMember(member6,member) member6.visible = true member_pos += 1 + OS.min_window_size = Vector2(1536,900) + OS.window_size = Vector2(1536,900) visible = true func _on_Back_pressed(): + OS.min_window_size = Vector2(1024,600) + OS.window_size = Vector2(1024,600) visible = false + +func MoveAids(type1,type2,node,member): + for child in node.get_node(\"Moves\").get_children(): + child.visible = false + var move_names = [\"move1\",\"move2\",\"move3\",\"move4\"] + for move in move_names: + var type_adv = 1 + var style = $Aid/Member1/Member.get_stylebox(\"panel\").duplicate() + var type = \"\" + match member[move][\"typing\"]: + types.NULL: + continue + types.NORMAL: + type = \"normal\" + types.FIRE: + type = \"fire\" + types.WATER: + type = \"water\" + types.GRASS: + type = \"grass\" + types.ELECTRIC: + type = \"electric\" + types.ICE: + type = \"ice\" + types.FIGHTING: + type = \"fighting\" + types.POISON: + type = \"poison\" + types.GROUND: + type = \"ground\" + types.FLYING: + type = \"flying\" + types.PSYCHIC: + type = \"psychic\" + types.BUG: + type = \"bug\" + types.ROCK: + type = \"rock\" + types.GHOST: + type = \"ghost\" + types.DARK: + type = \"dark\" + types.DRAGON: + type = \"dragon\" + types.STEEL: + type = \"steel\" + types.FAIRY: + type = \"fairy\" + if type1 != null and Pokemon.types_def[data_translate.typing(type1)].has(type): + type_adv *= Pokemon.types_def[data_translate.typing(type1)][type] + if type2 != null and Pokemon.types_def[data_translate.typing(type2)].has(type): + type_adv *= Pokemon.types_def[data_translate.typing(type2)][type] + if type_adv == 1: + style.set_bg_color(Color8(0,0,0,0)) + elif type_adv == 0: + style.set_bg_color(Color8(32,0,255,50)) + elif type_adv > 1: + style.set_bg_color(Color8(0,255,40,50)) + elif type_adv < 1: + style.set_bg_color(Color8(255,0,0,50)) + print(\"Moves/\"+(move.capitalize().replace(\" \",\"\"))) + node.get_node(\"Moves/\"+(move.capitalize().replace(\" \",\"\"))).add_stylebox_override(\"panel\",style) + node.get_node(\"Moves/\"+(move.capitalize().replace(\" \",\"\"))).visible = true + +func Aids(): + print(selected_types) + if selected_types.empty(): + pass + $Aid/Member1/Member.visible = false + $Aid/Member2/Member.visible = false + $Aid/Member3/Member.visible = false + $Aid/Member4/Member.visible = false + $Aid/Member5/Member.visible = false + $Aid/Member6/Member.visible = false + var member = Pokemon.pokemon[current_party[0]] + var member_pos = 0 + while member_pos < current_party.size(): + var style = $Aid/Member1/Member.get_stylebox(\"panel\").duplicate() + var type_adv = 1 + if current_party[member_pos] == null: + member_pos += 1 + continue + member = Pokemon.pokemon[current_party[member_pos]] + if selected_types[0] != null: + if Pokemon.types_def[member[\"type1\"]].has(selected_types[0]): + type_adv *= Pokemon.types_def[member[\"type1\"]][selected_types[0]] + if member[\"type2\"] != 0 and Pokemon.types_def[member[\"type2\"]].has(selected_types[0]): + type_adv *= Pokemon.types_def[member[\"type2\"]][selected_types[0]] + if selected_types[1] != null: + if Pokemon.types_def[member[\"type1\"]].has(selected_types[1]): + type_adv *= Pokemon.types_def[member[\"type1\"]][selected_types[1]] + if member[\"type2\"] != 0 and Pokemon.types_def[member[\"type2\"]].has(selected_types[1]): + type_adv *= Pokemon.types_def[member[\"type2\"]][selected_types[1]] + print(type_adv) + if type_adv == 1.0: + style.set_bg_color(Color8(0,0,0,0)) + elif type_adv == 0: + style.set_bg_color(Color8(32,0,255,50)) + elif type_adv > 1.0: + style.set_bg_color(Color8(255,0,0,50)) + elif type_adv < 1.0: + style.set_bg_color(Color8(0,255,40,50)) + match member_pos: + 0: + $Aid/Member1/Member.visible = true + $Aid/Member1/Member.add_stylebox_override(\"panel\",style) + MoveAids(selected_types[0],selected_types[1],$Aid/Member1,member) + 1: + $Aid/Member2/Member.visible = true + $Aid/Member2/Member.add_stylebox_override(\"panel\",style) + MoveAids(selected_types[0],selected_types[1],$Aid/Member2,member) + 2: + $Aid/Member3/Member.visible = true + $Aid/Member3/Member.add_stylebox_override(\"panel\",style) + MoveAids(selected_types[0],selected_types[1],$Aid/Member3,member) + 3: + $Aid/Member4/Member.visible = true + $Aid/Member4/Member.add_stylebox_override(\"panel\",style) + MoveAids(selected_types[0],selected_types[1],$Aid/Member4,member) + 4: + $Aid/Member5/Member.visible = true + $Aid/Member5/Member.add_stylebox_override(\"panel\",style) + MoveAids(selected_types[0],selected_types[1],$Aid/Member5,member) + 5: + $Aid/Member6/Member.visible = true + $Aid/Member6/Member.add_stylebox_override(\"panel\",style) + MoveAids(selected_types[0],selected_types[1],$Aid/Member6,member) + member_pos += 1 + if selected_types[0] != null and selected_types[1] != null: + for button in $Buttons.get_children(): + if selected_types.has(button.name.to_lower()): + continue + else: + button.disabled = true + else: + for button in $Buttons.get_children(): + button.disabled = false + +func toggled(pressed,type): + if pressed == true: + if selected_types[0] == null: + selected_types[0] = type + elif selected_types[1] == null: + selected_types[1] = type + else: + if selected_types.has(type): + selected_types[selected_types.find(type)] = null + Aids() + +func _on_Normal_toggled(button_pressed): + toggled(button_pressed,\"normal\") + +func _on_Fire_toggled(button_pressed): + toggled(button_pressed,\"fire\") + +func _on_Water_toggled(button_pressed): + toggled(button_pressed,\"water\") + +func _on_Grass_toggled(button_pressed): + toggled(button_pressed,\"grass\") + +func _on_Electric_toggled(button_pressed): + toggled(button_pressed,\"electric\") + +func _on_Ice_toggled(button_pressed): + toggled(button_pressed,\"ice\") + +func _on_Fighting_toggled(button_pressed): + toggled(button_pressed,\"fighting\") + +func _on_Poison_toggled(button_pressed): + toggled(button_pressed,\"poison\") + +func _on_Ground_toggled(button_pressed): + toggled(button_pressed,\"ground\") + +func _on_Flying_toggled(button_pressed): + toggled(button_pressed,\"flying\") + +func _on_Psychic_toggled(button_pressed): + toggled(button_pressed,\"psychic\") + +func _on_Bug_toggled(button_pressed): + toggled(button_pressed,\"bug\") + +func _on_Rock_toggled(button_pressed): + toggled(button_pressed,\"rock\") + +func _on_Ghost_toggled(button_pressed): + toggled(button_pressed,\"ghost\") + +func _on_Dark_toggled(button_pressed): + toggled(button_pressed,\"dark\") + +func _on_Dragon_toggled(button_pressed): + toggled(button_pressed,\"dragon\") + +func _on_Steel_toggled(button_pressed): + toggled(button_pressed,\"steel\") + +func _on_Fairy_toggled(button_pressed): + toggled(button_pressed,\"fairy\") " [sub_resource type="StyleBoxFlat" id=1] @@ -340,6 +551,13 @@ corner_radius_bottom_left = 128 [sub_resource type="StyleBoxFlat" id=57] bg_color = Color( 0.6, 0.6, 0.6, 0 ) +[sub_resource type="StyleBoxFlat" id=59] +bg_color = Color( 0.760784, 0.760784, 0.760784, 0.392157 ) +corner_radius_top_left = 128 +corner_radius_top_right = 128 +corner_radius_bottom_right = 128 +corner_radius_bottom_left = 128 + [sub_resource type="StyleBoxFlat" id=51] bg_color = Color( 0.6, 0.6, 0.6, 0 ) @@ -355,12 +573,15 @@ size = 22 font_data = ExtResource( 2 ) [sub_resource type="StyleBoxFlat" id=53] -bg_color = Color( 0, 1, 0.156863, 0.196078 ) -corner_radius_top_left = 16 -corner_radius_top_right = 16 -corner_radius_bottom_right = 16 +bg_color = Color( 0, 0, 0, 0 ) +corner_radius_top_left = 8 +corner_radius_top_right = 8 +corner_radius_bottom_right = 8 corner_radius_bottom_left = 16 +[sub_resource type="Theme" id=58] +Panel/styles/panel = SubResource( 53 ) + [sub_resource type="StyleBoxFlat" id=55] corner_radius_top_left = 8 corner_radius_top_right = 8 @@ -884,6 +1105,7 @@ theme = ExtResource( 1 ) custom_styles/hover = SubResource( 49 ) custom_styles/pressed = SubResource( 50 ) custom_styles/focus = SubResource( 57 ) +custom_styles/disabled = SubResource( 59 ) custom_styles/normal = SubResource( 51 ) toggle_mode = true flat = false @@ -902,6 +1124,7 @@ theme = ExtResource( 1 ) custom_styles/hover = SubResource( 49 ) custom_styles/pressed = SubResource( 50 ) custom_styles/focus = SubResource( 57 ) +custom_styles/disabled = SubResource( 59 ) custom_styles/normal = SubResource( 52 ) toggle_mode = true flat = false @@ -920,6 +1143,7 @@ theme = ExtResource( 1 ) custom_styles/hover = SubResource( 49 ) custom_styles/pressed = SubResource( 50 ) custom_styles/focus = SubResource( 57 ) +custom_styles/disabled = SubResource( 59 ) custom_styles/normal = SubResource( 52 ) toggle_mode = true flat = false @@ -938,6 +1162,7 @@ theme = ExtResource( 1 ) custom_styles/hover = SubResource( 49 ) custom_styles/pressed = SubResource( 50 ) custom_styles/focus = SubResource( 57 ) +custom_styles/disabled = SubResource( 59 ) custom_styles/normal = SubResource( 52 ) toggle_mode = true flat = false @@ -957,6 +1182,7 @@ theme = ExtResource( 1 ) custom_styles/hover = SubResource( 49 ) custom_styles/pressed = SubResource( 50 ) custom_styles/focus = SubResource( 57 ) +custom_styles/disabled = SubResource( 59 ) custom_styles/normal = SubResource( 52 ) toggle_mode = true flat = false @@ -976,6 +1202,7 @@ theme = ExtResource( 1 ) custom_styles/hover = SubResource( 49 ) custom_styles/pressed = SubResource( 50 ) custom_styles/focus = SubResource( 57 ) +custom_styles/disabled = SubResource( 59 ) custom_styles/normal = SubResource( 52 ) toggle_mode = true flat = false @@ -994,6 +1221,7 @@ theme = ExtResource( 1 ) custom_styles/hover = SubResource( 49 ) custom_styles/pressed = SubResource( 50 ) custom_styles/focus = SubResource( 57 ) +custom_styles/disabled = SubResource( 59 ) custom_styles/normal = SubResource( 52 ) toggle_mode = true flat = false @@ -1013,6 +1241,7 @@ theme = ExtResource( 1 ) custom_styles/hover = SubResource( 49 ) custom_styles/pressed = SubResource( 50 ) custom_styles/focus = SubResource( 57 ) +custom_styles/disabled = SubResource( 59 ) custom_styles/normal = SubResource( 52 ) toggle_mode = true flat = false @@ -1032,6 +1261,7 @@ theme = ExtResource( 1 ) custom_styles/hover = SubResource( 49 ) custom_styles/pressed = SubResource( 50 ) custom_styles/focus = SubResource( 57 ) +custom_styles/disabled = SubResource( 59 ) custom_styles/normal = SubResource( 52 ) toggle_mode = true flat = false @@ -1050,6 +1280,7 @@ theme = ExtResource( 1 ) custom_styles/hover = SubResource( 49 ) custom_styles/pressed = SubResource( 50 ) custom_styles/focus = SubResource( 57 ) +custom_styles/disabled = SubResource( 59 ) custom_styles/normal = SubResource( 52 ) toggle_mode = true flat = false @@ -1069,6 +1300,7 @@ theme = ExtResource( 1 ) custom_styles/hover = SubResource( 49 ) custom_styles/pressed = SubResource( 50 ) custom_styles/focus = SubResource( 57 ) +custom_styles/disabled = SubResource( 59 ) custom_styles/normal = SubResource( 52 ) toggle_mode = true flat = false @@ -1088,6 +1320,7 @@ theme = ExtResource( 1 ) custom_styles/hover = SubResource( 49 ) custom_styles/pressed = SubResource( 50 ) custom_styles/focus = SubResource( 57 ) +custom_styles/disabled = SubResource( 59 ) custom_styles/normal = SubResource( 52 ) toggle_mode = true flat = false @@ -1106,6 +1339,7 @@ theme = ExtResource( 1 ) custom_styles/hover = SubResource( 49 ) custom_styles/pressed = SubResource( 50 ) custom_styles/focus = SubResource( 57 ) +custom_styles/disabled = SubResource( 59 ) custom_styles/normal = SubResource( 52 ) toggle_mode = true flat = false @@ -1125,6 +1359,7 @@ theme = ExtResource( 1 ) custom_styles/hover = SubResource( 49 ) custom_styles/pressed = SubResource( 50 ) custom_styles/focus = SubResource( 57 ) +custom_styles/disabled = SubResource( 59 ) custom_styles/normal = SubResource( 52 ) toggle_mode = true flat = false @@ -1144,6 +1379,7 @@ theme = ExtResource( 1 ) custom_styles/hover = SubResource( 49 ) custom_styles/pressed = SubResource( 50 ) custom_styles/focus = SubResource( 57 ) +custom_styles/disabled = SubResource( 59 ) custom_styles/normal = SubResource( 52 ) toggle_mode = true flat = false @@ -1162,6 +1398,7 @@ theme = ExtResource( 1 ) custom_styles/hover = SubResource( 49 ) custom_styles/pressed = SubResource( 50 ) custom_styles/focus = SubResource( 57 ) +custom_styles/disabled = SubResource( 59 ) custom_styles/normal = SubResource( 52 ) toggle_mode = true flat = false @@ -1181,6 +1418,7 @@ theme = ExtResource( 1 ) custom_styles/hover = SubResource( 49 ) custom_styles/pressed = SubResource( 50 ) custom_styles/focus = SubResource( 57 ) +custom_styles/disabled = SubResource( 59 ) custom_styles/normal = SubResource( 52 ) toggle_mode = true flat = false @@ -1200,6 +1438,7 @@ theme = ExtResource( 1 ) custom_styles/hover = SubResource( 49 ) custom_styles/pressed = SubResource( 50 ) custom_styles/focus = SubResource( 57 ) +custom_styles/disabled = SubResource( 59 ) custom_styles/normal = SubResource( 52 ) toggle_mode = true flat = false @@ -4120,38 +4359,38 @@ __meta__ = { } [node name="Aid" type="GridContainer" parent="."] -visible = false anchor_left = 0.34375 -anchor_top = 0.0533333 +anchor_top = 0.0266667 anchor_right = 0.96875 -anchor_bottom = 0.955 +anchor_bottom = 0.963333 custom_constants/vseparation = 10 custom_constants/hseparation = 10 columns = 3 __meta__ = { +"_edit_group_": true, "_edit_use_anchors_": true } [node name="Member1" type="VBoxContainer" parent="Aid"] margin_right = 206.0 -margin_bottom = 265.0 +margin_bottom = 275.0 size_flags_horizontal = 3 size_flags_vertical = 3 [node name="Member" type="Panel" parent="Aid/Member1"] margin_right = 206.0 -margin_bottom = 141.0 +margin_bottom = 146.0 size_flags_horizontal = 3 size_flags_vertical = 3 -custom_styles/panel = SubResource( 53 ) +theme = SubResource( 58 ) __meta__ = { "_edit_group_": true } [node name="Moves" type="GridContainer" parent="Aid/Member1"] -margin_top = 145.0 +margin_top = 150.0 margin_right = 206.0 -margin_bottom = 265.0 +margin_bottom = 275.0 size_flags_horizontal = 3 size_flags_vertical = 3 size_flags_stretch_ratio = 0.85 @@ -4162,7 +4401,7 @@ __meta__ = { [node name="Move1" type="Panel" parent="Aid/Member1/Moves"] margin_right = 101.0 -margin_bottom = 58.0 +margin_bottom = 60.0 size_flags_horizontal = 3 size_flags_vertical = 3 custom_styles/panel = SubResource( 53 ) @@ -4173,7 +4412,7 @@ __meta__ = { [node name="Move2" type="Panel" parent="Aid/Member1/Moves"] margin_left = 105.0 margin_right = 206.0 -margin_bottom = 58.0 +margin_bottom = 60.0 size_flags_horizontal = 3 size_flags_vertical = 3 custom_styles/panel = SubResource( 53 ) @@ -4182,9 +4421,9 @@ __meta__ = { } [node name="Move3" type="Panel" parent="Aid/Member1/Moves"] -margin_top = 62.0 +margin_top = 64.0 margin_right = 101.0 -margin_bottom = 120.0 +margin_bottom = 124.0 size_flags_horizontal = 3 size_flags_vertical = 3 custom_styles/panel = SubResource( 53 ) @@ -4194,9 +4433,9 @@ __meta__ = { [node name="Move4" type="Panel" parent="Aid/Member1/Moves"] margin_left = 105.0 -margin_top = 62.0 +margin_top = 64.0 margin_right = 206.0 -margin_bottom = 120.0 +margin_bottom = 124.0 size_flags_horizontal = 3 size_flags_vertical = 3 custom_styles/panel = SubResource( 53 ) @@ -4207,24 +4446,24 @@ __meta__ = { [node name="Member2" type="VBoxContainer" parent="Aid"] margin_left = 216.0 margin_right = 422.0 -margin_bottom = 265.0 +margin_bottom = 275.0 size_flags_horizontal = 3 size_flags_vertical = 3 [node name="Member" type="Panel" parent="Aid/Member2"] margin_right = 206.0 -margin_bottom = 141.0 +margin_bottom = 146.0 size_flags_horizontal = 3 size_flags_vertical = 3 -custom_styles/panel = SubResource( 53 ) +theme = SubResource( 58 ) __meta__ = { "_edit_group_": true } [node name="Moves" type="GridContainer" parent="Aid/Member2"] -margin_top = 145.0 +margin_top = 150.0 margin_right = 206.0 -margin_bottom = 265.0 +margin_bottom = 275.0 size_flags_horizontal = 3 size_flags_vertical = 3 size_flags_stretch_ratio = 0.85 @@ -4235,7 +4474,7 @@ __meta__ = { [node name="Move1" type="Panel" parent="Aid/Member2/Moves"] margin_right = 101.0 -margin_bottom = 58.0 +margin_bottom = 60.0 size_flags_horizontal = 3 size_flags_vertical = 3 custom_styles/panel = SubResource( 53 ) @@ -4246,7 +4485,7 @@ __meta__ = { [node name="Move2" type="Panel" parent="Aid/Member2/Moves"] margin_left = 105.0 margin_right = 206.0 -margin_bottom = 58.0 +margin_bottom = 60.0 size_flags_horizontal = 3 size_flags_vertical = 3 custom_styles/panel = SubResource( 53 ) @@ -4255,9 +4494,9 @@ __meta__ = { } [node name="Move3" type="Panel" parent="Aid/Member2/Moves"] -margin_top = 62.0 +margin_top = 64.0 margin_right = 101.0 -margin_bottom = 120.0 +margin_bottom = 124.0 size_flags_horizontal = 3 size_flags_vertical = 3 custom_styles/panel = SubResource( 53 ) @@ -4267,9 +4506,9 @@ __meta__ = { [node name="Move4" type="Panel" parent="Aid/Member2/Moves"] margin_left = 105.0 -margin_top = 62.0 +margin_top = 64.0 margin_right = 206.0 -margin_bottom = 120.0 +margin_bottom = 124.0 size_flags_horizontal = 3 size_flags_vertical = 3 custom_styles/panel = SubResource( 53 ) @@ -4280,24 +4519,24 @@ __meta__ = { [node name="Member3" type="VBoxContainer" parent="Aid"] margin_left = 432.0 margin_right = 638.0 -margin_bottom = 265.0 +margin_bottom = 275.0 size_flags_horizontal = 3 size_flags_vertical = 3 [node name="Member" type="Panel" parent="Aid/Member3"] margin_right = 206.0 -margin_bottom = 141.0 +margin_bottom = 146.0 size_flags_horizontal = 3 size_flags_vertical = 3 -custom_styles/panel = SubResource( 53 ) +theme = SubResource( 58 ) __meta__ = { "_edit_group_": true } [node name="Moves" type="GridContainer" parent="Aid/Member3"] -margin_top = 145.0 +margin_top = 150.0 margin_right = 206.0 -margin_bottom = 265.0 +margin_bottom = 275.0 size_flags_horizontal = 3 size_flags_vertical = 3 size_flags_stretch_ratio = 0.85 @@ -4308,7 +4547,7 @@ __meta__ = { [node name="Move1" type="Panel" parent="Aid/Member3/Moves"] margin_right = 101.0 -margin_bottom = 58.0 +margin_bottom = 60.0 size_flags_horizontal = 3 size_flags_vertical = 3 custom_styles/panel = SubResource( 53 ) @@ -4319,7 +4558,7 @@ __meta__ = { [node name="Move2" type="Panel" parent="Aid/Member3/Moves"] margin_left = 105.0 margin_right = 206.0 -margin_bottom = 58.0 +margin_bottom = 60.0 size_flags_horizontal = 3 size_flags_vertical = 3 custom_styles/panel = SubResource( 53 ) @@ -4328,9 +4567,9 @@ __meta__ = { } [node name="Move3" type="Panel" parent="Aid/Member3/Moves"] -margin_top = 62.0 +margin_top = 64.0 margin_right = 101.0 -margin_bottom = 120.0 +margin_bottom = 124.0 size_flags_horizontal = 3 size_flags_vertical = 3 custom_styles/panel = SubResource( 53 ) @@ -4340,9 +4579,9 @@ __meta__ = { [node name="Move4" type="Panel" parent="Aid/Member3/Moves"] margin_left = 105.0 -margin_top = 62.0 +margin_top = 64.0 margin_right = 206.0 -margin_bottom = 120.0 +margin_bottom = 124.0 size_flags_horizontal = 3 size_flags_vertical = 3 custom_styles/panel = SubResource( 53 ) @@ -4351,26 +4590,26 @@ __meta__ = { } [node name="Member4" type="VBoxContainer" parent="Aid"] -margin_top = 275.0 +margin_top = 285.0 margin_right = 206.0 -margin_bottom = 540.0 +margin_bottom = 560.0 size_flags_horizontal = 3 size_flags_vertical = 3 [node name="Member" type="Panel" parent="Aid/Member4"] margin_right = 206.0 -margin_bottom = 141.0 +margin_bottom = 146.0 size_flags_horizontal = 3 size_flags_vertical = 3 -custom_styles/panel = SubResource( 53 ) +theme = SubResource( 58 ) __meta__ = { "_edit_group_": true } [node name="Moves" type="GridContainer" parent="Aid/Member4"] -margin_top = 145.0 +margin_top = 150.0 margin_right = 206.0 -margin_bottom = 265.0 +margin_bottom = 275.0 size_flags_horizontal = 3 size_flags_vertical = 3 size_flags_stretch_ratio = 0.85 @@ -4381,7 +4620,7 @@ __meta__ = { [node name="Move1" type="Panel" parent="Aid/Member4/Moves"] margin_right = 101.0 -margin_bottom = 58.0 +margin_bottom = 60.0 size_flags_horizontal = 3 size_flags_vertical = 3 custom_styles/panel = SubResource( 53 ) @@ -4392,7 +4631,7 @@ __meta__ = { [node name="Move2" type="Panel" parent="Aid/Member4/Moves"] margin_left = 105.0 margin_right = 206.0 -margin_bottom = 58.0 +margin_bottom = 60.0 size_flags_horizontal = 3 size_flags_vertical = 3 custom_styles/panel = SubResource( 53 ) @@ -4401,9 +4640,9 @@ __meta__ = { } [node name="Move3" type="Panel" parent="Aid/Member4/Moves"] -margin_top = 62.0 +margin_top = 64.0 margin_right = 101.0 -margin_bottom = 120.0 +margin_bottom = 124.0 size_flags_horizontal = 3 size_flags_vertical = 3 custom_styles/panel = SubResource( 53 ) @@ -4413,9 +4652,9 @@ __meta__ = { [node name="Move4" type="Panel" parent="Aid/Member4/Moves"] margin_left = 105.0 -margin_top = 62.0 +margin_top = 64.0 margin_right = 206.0 -margin_bottom = 120.0 +margin_bottom = 124.0 size_flags_horizontal = 3 size_flags_vertical = 3 custom_styles/panel = SubResource( 53 ) @@ -4425,26 +4664,26 @@ __meta__ = { [node name="Member5" type="VBoxContainer" parent="Aid"] margin_left = 216.0 -margin_top = 275.0 +margin_top = 285.0 margin_right = 422.0 -margin_bottom = 540.0 +margin_bottom = 560.0 size_flags_horizontal = 3 size_flags_vertical = 3 [node name="Member" type="Panel" parent="Aid/Member5"] margin_right = 206.0 -margin_bottom = 141.0 +margin_bottom = 146.0 size_flags_horizontal = 3 size_flags_vertical = 3 -custom_styles/panel = SubResource( 53 ) +theme = SubResource( 58 ) __meta__ = { "_edit_group_": true } [node name="Moves" type="GridContainer" parent="Aid/Member5"] -margin_top = 145.0 +margin_top = 150.0 margin_right = 206.0 -margin_bottom = 265.0 +margin_bottom = 275.0 size_flags_horizontal = 3 size_flags_vertical = 3 size_flags_stretch_ratio = 0.85 @@ -4455,7 +4694,7 @@ __meta__ = { [node name="Move1" type="Panel" parent="Aid/Member5/Moves"] margin_right = 101.0 -margin_bottom = 58.0 +margin_bottom = 60.0 size_flags_horizontal = 3 size_flags_vertical = 3 custom_styles/panel = SubResource( 53 ) @@ -4466,7 +4705,7 @@ __meta__ = { [node name="Move2" type="Panel" parent="Aid/Member5/Moves"] margin_left = 105.0 margin_right = 206.0 -margin_bottom = 58.0 +margin_bottom = 60.0 size_flags_horizontal = 3 size_flags_vertical = 3 custom_styles/panel = SubResource( 53 ) @@ -4475,9 +4714,9 @@ __meta__ = { } [node name="Move3" type="Panel" parent="Aid/Member5/Moves"] -margin_top = 62.0 +margin_top = 64.0 margin_right = 101.0 -margin_bottom = 120.0 +margin_bottom = 124.0 size_flags_horizontal = 3 size_flags_vertical = 3 custom_styles/panel = SubResource( 53 ) @@ -4487,9 +4726,9 @@ __meta__ = { [node name="Move4" type="Panel" parent="Aid/Member5/Moves"] margin_left = 105.0 -margin_top = 62.0 +margin_top = 64.0 margin_right = 206.0 -margin_bottom = 120.0 +margin_bottom = 124.0 size_flags_horizontal = 3 size_flags_vertical = 3 custom_styles/panel = SubResource( 53 ) @@ -4499,26 +4738,26 @@ __meta__ = { [node name="Member6" type="VBoxContainer" parent="Aid"] margin_left = 432.0 -margin_top = 275.0 +margin_top = 285.0 margin_right = 638.0 -margin_bottom = 540.0 +margin_bottom = 560.0 size_flags_horizontal = 3 size_flags_vertical = 3 [node name="Member" type="Panel" parent="Aid/Member6"] margin_right = 206.0 -margin_bottom = 141.0 +margin_bottom = 146.0 size_flags_horizontal = 3 size_flags_vertical = 3 -custom_styles/panel = SubResource( 53 ) +theme = SubResource( 58 ) __meta__ = { "_edit_group_": true } [node name="Moves" type="GridContainer" parent="Aid/Member6"] -margin_top = 145.0 +margin_top = 150.0 margin_right = 206.0 -margin_bottom = 265.0 +margin_bottom = 275.0 size_flags_horizontal = 3 size_flags_vertical = 3 size_flags_stretch_ratio = 0.85 @@ -4529,7 +4768,7 @@ __meta__ = { [node name="Move1" type="Panel" parent="Aid/Member6/Moves"] margin_right = 101.0 -margin_bottom = 58.0 +margin_bottom = 60.0 size_flags_horizontal = 3 size_flags_vertical = 3 custom_styles/panel = SubResource( 53 ) @@ -4540,7 +4779,7 @@ __meta__ = { [node name="Move2" type="Panel" parent="Aid/Member6/Moves"] margin_left = 105.0 margin_right = 206.0 -margin_bottom = 58.0 +margin_bottom = 60.0 size_flags_horizontal = 3 size_flags_vertical = 3 custom_styles/panel = SubResource( 53 ) @@ -4549,9 +4788,9 @@ __meta__ = { } [node name="Move3" type="Panel" parent="Aid/Member6/Moves"] -margin_top = 62.0 +margin_top = 64.0 margin_right = 101.0 -margin_bottom = 120.0 +margin_bottom = 124.0 size_flags_horizontal = 3 size_flags_vertical = 3 custom_styles/panel = SubResource( 53 ) @@ -4561,9 +4800,9 @@ __meta__ = { [node name="Move4" type="Panel" parent="Aid/Member6/Moves"] margin_left = 105.0 -margin_top = 62.0 +margin_top = 64.0 margin_right = 206.0 -margin_bottom = 120.0 +margin_bottom = 124.0 size_flags_horizontal = 3 size_flags_vertical = 3 custom_styles/panel = SubResource( 53 ) @@ -4583,4 +4822,22 @@ __meta__ = { "_edit_use_anchors_": true } +[connection signal="toggled" from="Buttons/Normal" to="." method="_on_Normal_toggled"] +[connection signal="toggled" from="Buttons/Fire" to="." method="_on_Fire_toggled"] +[connection signal="toggled" from="Buttons/Water" to="." method="_on_Water_toggled"] +[connection signal="toggled" from="Buttons/Grass" to="." method="_on_Grass_toggled"] +[connection signal="toggled" from="Buttons/Electric" to="." method="_on_Electric_toggled"] +[connection signal="toggled" from="Buttons/Ice" to="." method="_on_Ice_toggled"] +[connection signal="toggled" from="Buttons/Fighting" to="." method="_on_Fighting_toggled"] +[connection signal="toggled" from="Buttons/Poison" to="." method="_on_Poison_toggled"] +[connection signal="toggled" from="Buttons/Ground" to="." method="_on_Ground_toggled"] +[connection signal="toggled" from="Buttons/Flying" to="." method="_on_Flying_toggled"] +[connection signal="toggled" from="Buttons/Psychic" to="." method="_on_Psychic_toggled"] +[connection signal="toggled" from="Buttons/Bug" to="." method="_on_Bug_toggled"] +[connection signal="toggled" from="Buttons/Rock" to="." method="_on_Rock_toggled"] +[connection signal="toggled" from="Buttons/Ghost" to="." method="_on_Ghost_toggled"] +[connection signal="toggled" from="Buttons/Dark" to="." method="_on_Dark_toggled"] +[connection signal="toggled" from="Buttons/Dragon" to="." method="_on_Dragon_toggled"] +[connection signal="toggled" from="Buttons/Steel" to="." method="_on_Steel_toggled"] +[connection signal="toggled" from="Buttons/Fairy" to="." method="_on_Fairy_toggled"] [connection signal="pressed" from="Back" to="." method="_on_Back_pressed"] diff --git a/Search.tscn b/Search.tscn index 8500b51f..55106252 100644 --- a/Search.tscn +++ b/Search.tscn @@ -86,9 +86,6 @@ margin_bottom = -488.0 text = "All" items = [ "All", null, false, 0, null, "Normal", null, false, 1, null, "Fire", null, false, 2, null, "Water", null, false, 3, null, "Grass", null, false, 4, null, "Electric", null, false, 5, null, "Ice", null, false, 6, null, "Fighting", null, false, 7, null, "Poison", null, false, 8, null, "Ground", null, false, 9, null, "Flying", null, false, 10, null, "Psychic", null, false, 11, null, "Bug", null, false, 12, null, "Rock", null, false, 13, null, "Ghost", null, false, 14, null, "Dark", null, false, 15, null, "Dragon", null, false, 16, null, "Steel", null, false, 17, null, "Fairy", null, false, 18, null ] selected = 0 -__meta__ = { -"_edit_use_anchors_": false -} [node name="Gender" type="OptionButton" parent="Panel"] anchor_right = 1.0 @@ -98,7 +95,7 @@ margin_top = 100.0 margin_right = -28.0 margin_bottom = -456.0 text = "All" -items = [ "All", null, false, 1, null, "Male", null, false, 0, null, "Female", null, false, 2, null, "N/A", null, false, 4, null ] +items = [ "All", null, false, 3, null, "Male", null, false, 0, null, "Female", null, false, 1, null, "N/A", null, false, 2, null ] selected = 0 __meta__ = { "_edit_use_anchors_": false diff --git a/Types.tscn b/Types.tscn index daf28c14..0bd9bf44 100644 --- a/Types.tscn +++ b/Types.tscn @@ -10,26 +10,6 @@ script/source = "extends PopupPanel # Declare member variables here. Examples: # var a = 2 # var b = \"text\" -const types_def = { - 1:{\"fighting\":2,\"ghost\":0}, - 2:{\"fire\":0.5,\"water\":2,\"grass\":0.5,\"ice\":0.5,\"ground\":2,\"bug\":0.5,\"rock\":2,\"steel\":0.5,\"fairy\":0.5}, - 3:{\"fire\":0.5,\"water\":0.5,\"electric\":2,\"grass\":2,\"ice\":0.5,\"steel\":0.5}, - 4:{\"fire\":2,\"water\":0.5,\"electric\":0.5,\"grass\":0.5,\"ice\":2,\"poison\":2,\"ground\":0.5,\"flying\":2,\"bug\":2}, - 5:{\"electric\":0.5,\"ground\":2,\"flying\":0.5,\"steel\":0.5}, - 6:{\"fire\":2,\"ice\":0.5,\"fighting\":2,\"rock\":2,\"steel\":2}, - 7:{\"flying\":2,\"psychic\":2,\"bug\":0.5,\"rock\":0.5,\"dark\":0.5,\"fairy\":2}, - 8:{\"grass\":0.5,\"fighting\":0.5,\"poison\":0.5,\"ground\":2,\"psychic\":2,\"bug\":0.5,\"fairy\":0.5}, - 9:{\"water\":2,\"electric\":0,\"grass\":2,\"ice\":2,\"poison\":0.5,\"rock\":0.5}, - 10:{\"electric\":2,\"grass\":0.5,\"ice\":2,\"fighting\":0.5,\"ground\":0,\"bug\":0.5,\"rock\":2}, - 11:{\"fighting\":0.5,\"psychic\":0.5,\"bug\":2,\"ghost\":2,\"dark\":2}, - 12:{\"fire\":2,\"grass\":0.5,\"fighting\":0.5,\"ground\":0.5,\"flying\":2,\"rock\":2}, - 13:{\"normal\":0.5,\"fire\":0.5,\"water\":2,\"grass\":2,\"fighting\":2,\"poison\":0.5,\"ground\":2,\"flying\":0.5,\"steel\":2}, - 14:{\"normal\":0,\"fighting\":0,\"poison\":0.5,\"bug\":0.5,\"ghost\":2,\"dark\":2}, - 15:{\"fighting\":2,\"psychic\":0,\"bug\":2,\"ghost\":0.5,\"dark\":0.5,\"fairy\":2}, - 16:{\"fire\":0.5,\"water\":0.5,\"electric\":0.5,\"grass\":0.5,\"ice\":2,\"dragon\":2,\"fairy\":2}, - 17:{\"normal\":0.5,\"fire\":2,\"grass\":0.5,\"ice\":0.5,\"fighting\":2,\"poison\":0,\"ground\":2,\"flying\":0.5,\"psychic\":0.5,\"bug\":0.5,\"rock\":0.5,\"dragon\":0.5,\"steel\":0.5,\"fairy\":0.5}, - 18:{\"fighting\":0.5,\"poison\":2,\"bug\":0.5,\"dragon\":0,\"dark\":0.5,\"steel\":2} - } # Called when the node enters the scene tree for the first time. func _ready(): @@ -41,14 +21,14 @@ func setChart(type1,type2): for child in $HBoxContainer/Multipliers.get_children(): child.text = \"1\" child.visible = false - var type1_interactions = types_def[type1] + var type1_interactions = Pokemon.types_def[type1] print(type1_interactions.keys()) for key in type1_interactions.keys(): $HBoxContainer/Rows.get_node(key.capitalize()).visible = true $HBoxContainer/Multipliers.get_node(key.capitalize()).visible = true $HBoxContainer/Multipliers.get_node(key.capitalize()).text = str(int($HBoxContainer/Multipliers.get_node(key.capitalize()).text)*type1_interactions[key]) if type2 != 0: - var type2_interactions = types_def[type2] + var type2_interactions = Pokemon.types_def[type2] for key in type2_interactions.keys(): $HBoxContainer/Rows.get_node(key.capitalize()).visible = true $HBoxContainer/Multipliers.get_node(key.capitalize()).visible = true @@ -201,10 +181,10 @@ script = SubResource( 20 ) [node name="HBoxContainer" type="HBoxContainer" parent="."] anchor_right = 1.0 anchor_bottom = 1.0 -margin_left = 16.0 -margin_top = 16.0 -margin_right = -16.0 -margin_bottom = -16.0 +margin_left = 4.0 +margin_top = 4.0 +margin_right = -4.0 +margin_bottom = -4.0 size_flags_horizontal = 3 size_flags_vertical = 3 @@ -848,8 +828,10 @@ align = 1 visible = false anchor_right = 1.0 anchor_bottom = 1.0 -margin_left = 56.0 -margin_top = 29.0 +margin_left = 4.0 +margin_top = 4.0 +margin_right = -4.0 +margin_bottom = -4.0 size_flags_horizontal = 3 size_flags_vertical = 3 columns = 18 diff --git a/project.godot b/project.godot index 114ffc8c..594db569 100644 --- a/project.godot +++ b/project.godot @@ -41,6 +41,7 @@ Pokemon="*res://scripts/Pokemon.gd" Trainer="*res://scripts/Trainer.gd" PokemonShowdown="*res://scripts/pokemon_showdown.gd" PM="*res://scripts/PM.gd" +Trading="*res://scripts/Trading.gd" [display] diff --git a/scenes/Bank.tscn b/scenes/Bank.tscn index 3a924ca9..af9452c1 100644 --- a/scenes/Bank.tscn +++ b/scenes/Bank.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=26 format=2] +[gd_scene load_steps=27 format=2] [ext_resource path="res://Menu.tscn" type="PackedScene" id=1] [ext_resource path="res://Panel.tscn" type="PackedScene" id=2] @@ -18,6 +18,7 @@ [ext_resource path="res://box.png" type="Texture" id=16] [ext_resource path="res://Folder_Icon.png" type="Texture" id=17] [ext_resource path="res://box_top.png" type="Texture" id=18] +[ext_resource path="res://scenes/Trading.tscn" type="PackedScene" id=19] [sub_resource type="DynamicFont" id=11] font_data = ExtResource( 7 ) @@ -30,6 +31,7 @@ var text = { \"api\":\"Fetching info from the web...\", \"reading\":\"Reading bank file...\", \"layout\":\"Organizing the bank...\", + \"welcome\":\"Welcome to Pokémon Manager!\" } func _ready(): @@ -40,6 +42,8 @@ func switch(x): $Label.text = text[x] func finised(): + $Label.text = text[\"welcome\"] + $ProgressBar.visible = false $Control/AnimationPlayer.play(\"Finished\") yield($Control/AnimationPlayer,\"animation_finished\") $WalkingPokemon.visible = false @@ -457,8 +461,8 @@ __meta__ = { [node name="Control" type="Control" parent="Loading Screen"] anchor_right = 1.0 anchor_bottom = 1.0 -margin_right = 17408.0 -margin_bottom = 10200.0 +margin_right = 25600.0 +margin_bottom = 15000.0 [node name="Sprite" type="Sprite" parent="Loading Screen/Control"] position = Vector2( 512, 256 ) @@ -513,7 +517,7 @@ anchor_bottom = 1.0 [node name="PopupMenu" type="PopupMenu" parent="."] margin_right = 88.0 margin_bottom = 128.0 -items = [ "Box", null, 0, false, true, -1, 0, null, "", true, "Add a new box", null, 0, false, false, 0, 0, null, "", false, "Remove this box", null, 0, false, true, 5, 0, null, "", false, "Rename box", null, 0, false, false, 1, 0, null, "", false, "Copy box to clipboard", null, 0, false, false, 2, 0, null, "", false, "Pokémon", null, 0, false, true, -1, 0, null, "", true, "Search for Pokémon", null, 0, false, false, 2, 0, null, "", false, "Manage parties", null, 0, false, false, 3, 0, null, "", false ] +items = [ "Box", null, 0, false, true, -1, 0, null, "", true, "Add a new box", null, 0, false, false, 0, 0, null, "", false, "Remove this box", null, 0, false, true, 5, 0, null, "", false, "Rename box", null, 0, false, false, 1, 0, null, "", false, "Copy box to clipboard", null, 0, false, false, 4, 0, null, "", false, "Pokémon", null, 0, false, true, -1, 0, null, "", true, "Search for Pokémon", null, 0, false, false, 2, 0, null, "", false, "Manage parties", null, 0, false, false, 3, 0, null, "", false, "Trade with someone else", null, 0, false, false, 6, 0, null, "", false ] script = ExtResource( 10 ) [node name="Rename" type="PopupDialog" parent="."] @@ -667,6 +671,9 @@ visible = false [node name="Panel" parent="." instance=ExtResource( 2 )] visible = false +[node name="Trade" parent="." instance=ExtResource( 19 )] +visible = false + [node name="Menu" parent="." instance=ExtResource( 1 )] visible = false diff --git a/scenes/NetworkTrainer.tscn b/scenes/NetworkTrainer.tscn new file mode 100644 index 00000000..fb50cafc --- /dev/null +++ b/scenes/NetworkTrainer.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://scripts/NetworkTrainer.gd" type="Script" id=1] + +[node name="NetworkTrainer" type="Node"] +script = ExtResource( 1 ) diff --git a/scenes/Trading.tscn b/scenes/Trading.tscn new file mode 100644 index 00000000..b17ebd0f --- /dev/null +++ b/scenes/Trading.tscn @@ -0,0 +1,71 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://scripts/TradeScreen.gd" type="Script" id=1] + +[node name="Trade" type="Panel"] +anchor_right = 1.0 +anchor_bottom = 1.0 +script = ExtResource( 1 ) + +[node name="Trainer" type="Panel" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 + +[node name="RichTextLabel" type="RichTextLabel" parent="Trainer"] +anchor_left = 0.382813 +anchor_top = 0.28 +anchor_right = 0.617188 +anchor_bottom = 0.72 +margin_bottom = -3.05176e-05 +__meta__ = { +"_edit_use_anchors_": true +} + +[node name="Connecting" type="Panel" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 + +[node name="Create_Server" type="Button" parent="Connecting"] +anchor_left = 0.382813 +anchor_top = 0.48 +anchor_right = 0.492188 +anchor_bottom = 0.52 +text = "Create server" +__meta__ = { +"_edit_use_anchors_": true +} + +[node name="Join_Server" type="Button" parent="Connecting"] +anchor_left = 0.507813 +anchor_top = 0.48 +anchor_right = 0.617188 +anchor_bottom = 0.52 +text = "Join Server" +__meta__ = { +"_edit_use_anchors_": true +} + +[node name="IP_Address" type="LineEdit" parent="Connecting"] +anchor_left = 0.382813 +anchor_top = 0.526667 +anchor_right = 0.617188 +anchor_bottom = 0.566667 +align = 1 +placeholder_text = "Enter IP Address" +__meta__ = { +"_edit_use_anchors_": true +} + +[node name="Label" type="Label" parent="Connecting"] +anchor_left = 0.382813 +anchor_top = 0.44 +anchor_right = 0.617188 +anchor_bottom = 0.473333 +__meta__ = { +"_edit_use_anchors_": true +} + +[node name="Trainers" type="Node" parent="."] + +[connection signal="pressed" from="Connecting/Create_Server" to="." method="_on_Create_Server_pressed"] +[connection signal="pressed" from="Connecting/Join_Server" to="." method="_on_Join_Server_pressed"] diff --git a/scripts/NetworkTrainer.gd b/scripts/NetworkTrainer.gd new file mode 100644 index 00000000..216e0d0e --- /dev/null +++ b/scripts/NetworkTrainer.gd @@ -0,0 +1,16 @@ +extends Node + + +# Declare member variables here. Examples: +# var a = 2 +# var b = "text" +puppet var profile_pic = null +puppet var profile_name = "" + +func _ready(): + pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +#func _process(delta): +# pass diff --git a/scripts/Pokemon.gd b/scripts/Pokemon.gd index b530bf8c..a627f1d0 100644 --- a/scripts/Pokemon.gd +++ b/scripts/Pokemon.gd @@ -607,6 +607,32 @@ const rates = { 68116 ] } +const types_def = { + 1:{"fighting":2,"ghost":0}, + 2:{"fire":0.5,"water":2,"grass":0.5,"ice":0.5,"ground":2,"bug":0.5,"rock":2,"steel":0.5,"fairy":0.5}, + 3:{"fire":0.5,"water":0.5,"electric":2,"grass":2,"ice":0.5,"steel":0.5}, + 4:{"fire":2,"water":0.5,"electric":0.5,"grass":0.5,"ice":2,"poison":2,"ground":0.5,"flying":2,"bug":2}, + 5:{"electric":0.5,"ground":2,"flying":0.5,"steel":0.5}, + 6:{"fire":2,"ice":0.5,"fighting":2,"rock":2,"steel":2}, + 7:{"flying":2,"psychic":2,"bug":0.5,"rock":0.5,"dark":0.5,"fairy":2}, + 8:{"grass":0.5,"fighting":0.5,"poison":0.5,"ground":2,"psychic":2,"bug":0.5,"fairy":0.5}, + 9:{"water":2,"electric":0,"grass":2,"ice":2,"poison":0.5,"rock":0.5}, + 10:{"electric":2,"grass":0.5,"ice":2,"fighting":0.5,"ground":0,"bug":0.5,"rock":2}, + 11:{"fighting":0.5,"psychic":0.5,"bug":2,"ghost":2,"dark":2}, + 12:{"fire":2,"grass":0.5,"fighting":0.5,"ground":0.5,"flying":2,"rock":2}, + 13:{"normal":0.5,"fire":0.5,"water":2,"grass":2,"fighting":2,"poison":0.5,"ground":2,"flying":0.5,"steel":2}, + 14:{"normal":0,"fighting":0,"poison":0.5,"bug":0.5,"ghost":2,"dark":2}, + 15:{"fighting":2,"psychic":0,"bug":2,"ghost":0.5,"dark":0.5,"fairy":2}, + 16:{"fire":0.5,"water":0.5,"electric":0.5,"grass":0.5,"ice":2,"dragon":2,"fairy":2}, + 17:{"normal":0.5,"fire":2,"grass":0.5,"ice":0.5,"fighting":2,"poison":0,"ground":2,"flying":0.5,"psychic":0.5,"bug":0.5,"rock":0.5,"dragon":0.5,"steel":0.5,"fairy":0.5}, + 18:{"fighting":0.5,"poison":2,"bug":0.5,"dragon":0,"dark":0.5,"steel":2} +} +const types_atk = { + "normal":[13,14,17], + "fire":[2,3,4,6,12,16], + "water":[2,3,4,9,16], + "grass":[2,3,4] +} enum { # Pokémon Sapphire (GBA) S = 1, @@ -700,7 +726,7 @@ func search(search): if pokemon[x]["type2"] != search["type2"]: print("Erased "+x+" because of "+str(pokemon[x]["type2"])) results.erase(x) - if search["gender"] != 1: + if search["gender"] != 3: var ids = results.duplicate() for x in ids: if pokemon[x]["gender"] != search["gender"]: diff --git a/scripts/RightClickMenu.gd b/scripts/RightClickMenu.gd index d313e361..5cfdfa99 100644 --- a/scripts/RightClickMenu.gd +++ b/scripts/RightClickMenu.gd @@ -32,6 +32,8 @@ func _on_PopupMenu_id_pressed(id): if tab.isEmpty(): tabs.remove_child(tab) tab.queue_free() + 6: + $"../Trade".visible = true func _on_PopupMenu_about_to_show(): var tab = tabs.get_tab_control(tabs.current_tab) diff --git a/scripts/TradeScreen.gd b/scripts/TradeScreen.gd new file mode 100644 index 00000000..636a23ce --- /dev/null +++ b/scripts/TradeScreen.gd @@ -0,0 +1,53 @@ +extends Panel + + +# Declare member variables here. Examples: +# var a = 2 +# var b = "text" + +var new_trainer = load("res://scenes/NetworkTrainer.tscn") +# Called when the node enters the scene tree for the first time. +func _ready(): + get_tree().connect("network_peer_connected", self,"_player_connected") + get_tree().connect("network_peer_disconnected", self,"_player_disconnected") + get_tree().connect("connected_to_server", self, "_connected_to_server") + $Connecting/Label.text = Trading.ip_address + +func _player_connected(id) -> void: + instance_trainer({"name":Trainer.trainer_name,"pic":Trainer.trainer_picture},id) + print("Player "+str(id)+" has connected") + +func _player_disconnected(id) -> void: + print("Player "+str(id)+" has disconnected") + +func _connected_to_server() -> void: + instance_trainer({"name":Trainer.trainer_name,"pic":Trainer.trainer_picture},get_tree().get_network_unique_id()) + +func _on_Create_Server_pressed(): + $Connecting.visible = false + Trading.create_server() + instance_trainer({"name":Trainer.trainer_name,"pic":Trainer.trainer_picture},get_tree().get_network_unique_id()) + + +func _on_Join_Server_pressed(): + if $Connecting/IP_Address.text != "": + $Connecting.visible = false + Trading.ip_address = $Connecting/IP_Address.text + Trading.join_server() + +func instance_trainer(info,id): + var trainer_instance = new_trainer.instance() + print("Player "+str(info["name"])+" has connected") + trainer_instance.profile_name = info["name"] + trainer_instance.profile_pic = info["pic"] + trainer_instance.set_network_master(id) + $Trainers.add_child(trainer_instance) + listTrainers() + +func listTrainers(): + var text = "" + print(get_tree().get_network_connected_peers()) + for trainer in get_tree().get_network_connected_peers(): + var node = get_node(str(trainer)) + text += node.profile_name+"\n" + $Trainer/RichTextLabel.text = text diff --git a/scripts/Trading.gd b/scripts/Trading.gd new file mode 100644 index 00000000..bc3c0e7c --- /dev/null +++ b/scripts/Trading.gd @@ -0,0 +1,32 @@ +extends Node + +const DEFAULT_PORT = 28960 +const MAX_CLIENTS = 2 + +var server = null +var client = null + +var ip_address = "" +# Called when the node enters the scene tree for the first time. +func _ready(): + for ip in IP.get_local_addresses(): + if ip.begins_with("192.168."): + ip_address = ip + get_tree().connect("connected_to_server", self, "_connected_to_server") + get_tree().connect("server_disconnected", self, "_server_disconnected") + +func create_server() -> void: + server = NetworkedMultiplayerENet.new() + server.create_server(DEFAULT_PORT, MAX_CLIENTS) + get_tree().set_network_peer(server) + +func join_server() -> void: + client = NetworkedMultiplayerENet.new() + client.create_client(ip_address, DEFAULT_PORT) + get_tree().set_network_peer(client) + +func _connect_to_server() -> void: + print("Successfully connected to the server") + +func _server_disconnected() -> void: + print("Disconnected from the server")