Compare commits

..

No commits in common. "f7de5413413ab7dca84905cde5e6a52995a0dfe8" and "dca0def35017433531d76fd8e2c527d629910d9d" have entirely different histories.

29 changed files with 41 additions and 313 deletions

View File

@ -1,21 +0,0 @@
[gd_resource type="Resource" load_steps=2 format=2]
[ext_resource path="res://Assets/CardDB/CardBD.gd" type="Script" id=1]
[resource]
script = ExtResource( 1 )
name = "Broadsword"
type = 0
effect_damage_range = 2
move_amount_addition = 0
move_dice_multiplyer = 1
damage_amount_addition = 0
damage_dice_multiplyer = 0
effects = [ ]
accepted_dice = [ ]
number_of_dice = 2
same_dice_requirement = false
addition_dice = false
addition_amount = -1
description = "Does damage equal to the sum of both dice to all enemies
Range: 2 spaces"

View File

@ -10,6 +10,8 @@ enum TYPE {
} }
enum EFFECT { enum EFFECT {
NONE
POISON POISON
BURN BURN
CONFUSION CONFUSION
@ -32,12 +34,8 @@ enum ACCEPTED_DICE {
DICE_6 DICE_6
} }
export (String) var name = ""
export (TYPE) var type export (TYPE) var type
export (int) var effect_damage_range = 0
export (int) var move_amount_addition export (int) var move_amount_addition
export (int) var move_dice_multiplyer export (int) var move_dice_multiplyer

View File

@ -4,17 +4,15 @@
[resource] [resource]
script = ExtResource( 1 ) script = ExtResource( 1 )
name = "Default"
type = 0 type = 0
effect_damage_range = 0
move_amount_addition = 0 move_amount_addition = 0
move_dice_multiplyer = 0 move_dice_multiplyer = 0
damage_amount_addition = 0 damage_amount_addition = 0
damage_dice_multiplyer = 0 damage_dice_multiplyer = 1
effects = [ ] effects = [ ]
accepted_dice = [ ] accepted_dice = [ ]
number_of_dice = 1 number_of_dice = 1
same_dice_requirement = false same_dice_requirement = false
addition_dice = false addition_dice = false
addition_amount = -1 addition_amount = -1
description = "Default Description" description = "Damage Dice Roll"

View File

@ -4,11 +4,9 @@
[resource] [resource]
script = ExtResource( 1 ) script = ExtResource( 1 )
name = "Magic Carving Knife" type = 3
type = 1
effect_damage_range = 0
move_amount_addition = 0 move_amount_addition = 0
move_dice_multiplyer = 0 move_dice_multiplyer = 1
damage_amount_addition = 0 damage_amount_addition = 0
damage_dice_multiplyer = 0 damage_dice_multiplyer = 0
effects = [ 4 ] effects = [ 4 ]
@ -17,4 +15,4 @@ number_of_dice = 1
same_dice_requirement = false same_dice_requirement = false
addition_dice = false addition_dice = false
addition_amount = -1 addition_amount = -1
description = "Split your dice in half" description = "Move Dice Roll + 1"

View File

@ -4,9 +4,7 @@
[resource] [resource]
script = ExtResource( 1 ) script = ExtResource( 1 )
name = "Sprint"
type = 4 type = 4
effect_damage_range = 0
move_amount_addition = 1 move_amount_addition = 1
move_dice_multiplyer = 1 move_dice_multiplyer = 1
damage_amount_addition = 0 damage_amount_addition = 0
@ -17,4 +15,4 @@ number_of_dice = 1
same_dice_requirement = false same_dice_requirement = false
addition_dice = false addition_dice = false
addition_amount = -1 addition_amount = -1
description = "Move your dice roll + 1 spaces" description = "Move Dice Roll + 1"

View File

@ -1,21 +0,0 @@
[gd_resource type="Resource" load_steps=2 format=2]
[ext_resource path="res://Assets/CardDB/CardBD.gd" type="Script" id=1]
[resource]
script = ExtResource( 1 )
name = "Poisonous apple"
type = 3
effect_damage_range = 3
move_amount_addition = 0
move_dice_multiplyer = 0
damage_amount_addition = 0
damage_dice_multiplyer = 0
effects = [ 0, 9 ]
accepted_dice = [ 0, 1 ]
number_of_dice = 1
same_dice_requirement = false
addition_dice = false
addition_amount = -1
description = "Poison enemies and reroll your dice
Range: 3 spaces"

View File

@ -1,103 +0,0 @@
extends Control
#"soft" because it isn't enforced if the grid wouldn't fit otherwise
export var soft_minimum_columns : int = 2
#these should come from the theme or from theme overrides
export var grid_hseperation : int = 4
export var grid_vseperation : int = 4
var _node_width = -1
var _node_height = -1
onready var grid_container = $Scroll/VBox/GridContainer
func _update_node_size():
if len(grid_container.get_children()) == 0:
return -1
#duplicate a node, assuming they are all the same
$MinSizeTesting.add_child(grid_container.get_child(0).duplicate())
#set the size to the minimum
$MinSizeTesting.get_child(0).rect_size = Vector2(0, 0)
#get the smallest possible size they can contain
_node_width = $MinSizeTesting.get_child(0).rect_size.x
_node_height = $MinSizeTesting.get_child(0).rect_size.y
#plus any seperation due to the grid
_node_width += grid_hseperation
_node_height += grid_vseperation
#remove the copied node
$MinSizeTesting.get_child(0).queue_free()
func _process(_delta: float) -> void:
_move_children_to_grid()
#don't do anything if there are no children
if len(grid_container.get_children()) == 0:
return
#don't do anything if the node's haven't got a size yet
if _node_width == -1 or _node_height == -1:
_update_node_size()
return
#window_size in case an issue occures with resizing
var screen_width = min(rect_size.x, OS.window_size.x)
var screen_height = min(rect_size.y, OS.window_size.y)
#(columns - 1) means that it can still shrink in size
grid_container.columns = max(1, int(screen_width/_node_width) - 1)
#don't allow more columns than children (wasted space)
grid_container.columns = min(grid_container.columns, grid_container.get_child_count())
#this is used to adjust the columns so that maximum space avalible is used
for _i in 10:
var empty_rows = _calculate_empty_rows(grid_container.columns, screen_height)
#check if perfect height already
if empty_rows <= 0:
break
#disallow single width (unless required previously)
if grid_container.columns <= soft_minimum_columns:
break
#check that it won't need to scroll if columns change
if _get_rows(grid_container.columns - 1) * _node_height > screen_height:
break
grid_container.columns -= 1
func _calculate_empty_rows(columns, screen_height):
var rows = _get_rows(columns)
var height_not_used : int = screen_height - rows * _node_height
var empty_rows : int = height_not_used / _node_height
return empty_rows
func _get_rows(columns):
# rows = children // columns + 1 (if remainder)
var rows = grid_container.get_child_count() / columns
rows += 1 if grid_container.get_child_count() % columns != 0 else 0
return rows
func _move_children_to_grid():
#puts the children into the grid container
#ignores the first 2 children (container and size tester)
for _i in range(2, get_child_count()):
var child = get_child(2)
remove_child(child)
grid_container.add_child(child)
#allow getting nodes from the grid (null, no error version)
func get_node_from_grid(node_path : NodePath) -> Node:
if grid_container.has_node(node_path):
return grid_container.get_node(node_path)
else:
return null

View File

@ -1,32 +0,0 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://AutoGridContainer - Full Version/AutoGridContainer.gd" type="Script" id=1]
[node name="AutoGridContainer" type="Control"]
margin_right = 1024.0
margin_bottom = 600.0
size_flags_horizontal = 3
size_flags_vertical = 3
script = ExtResource( 1 )
[node name="Scroll" type="ScrollContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
size_flags_vertical = 3
scroll_horizontal_enabled = false
[node name="VBox" type="VBoxContainer" parent="Scroll"]
margin_right = 1024.0
margin_bottom = 600.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="GridContainer" type="GridContainer" parent="Scroll/VBox"]
margin_right = 1024.0
margin_bottom = 600.0
size_flags_horizontal = 3
size_flags_vertical = 3
columns = 3
[node name="MinSizeTesting" type="Node" parent="."]

View File

@ -1,55 +1,20 @@
tool tool
extends Control extends Control
signal return_dice(dice_number) export (Resource) var card_info
const TYPE_COLORS = [ const TYPE_COLORS = [
Color("#db4758"), # DAMAGE Color("#db4758"), # DAMAGE
Color("#3cc361"), # UTILITY Color("#3cc361"), # UTILITY
Color("#bcb64f"), # SPECIAL Color("#ddd55c"), # SPECIAL
Color("#bc5ec6"), # EFFECT Color("#bc5ec6"), # EFFECT
Color("#a4a4a4"), # MOVEMENT Color("#a4a4a4"), # MOVEMENT
] ]
export (Resource) var card_info
var input_dice = []
func _ready(): func _ready():
# change the color of the panel to match the appropriate type # change the color of the panel to match the appropriate type
var card_style = $PanelContainer.get('custom_styles/panel').duplicate(true) var card_style = $PanelContainer.get('custom_styles/panel').duplicate(true)
card_style.set_bg_color(TYPE_COLORS[card_info.type]) card_style.set_bg_color(TYPE_COLORS[card_info.type])
$PanelContainer.set('custom_styles/panel', card_style) $PanelContainer.set('custom_styles/panel', card_style)
# add more input dice if needed
for i in range(1, card_info.number_of_dice):
var new_input_dice = get_node("VBox/AutoGrid/InputDice0").duplicate(true)
new_input_dice.name = "InputDice%s" % i
$VBox/AutoGrid.add_child(new_input_dice)
# change the name and description
$VBox/Name.text = card_info.name
$VBox/Description.text = card_info.description
func dice_inputted(dice_number : int):
#check if dice is within dice range
if dice_number >= 1 and dice_number <= 6:
return
#if accepted dice is specified, check if the dice is in the list
if (len(card_info.accepted_dice) != 0 and
not dice_number in card_info.accepted_dice):
emit_signal("return_dice", dice_number)
return
input_dice.append(dice_number)
if len(input_dice) == card_info.number_of_dice:
run_card()
func run_card():
pass

View File

@ -1,42 +1,18 @@
[gd_scene load_steps=12 format=2] [gd_scene load_steps=4 format=2]
[ext_resource path="res://UI/Card.gd" type="Script" id=1] [ext_resource path="res://UI/Card.gd" type="Script" id=1]
[ext_resource path="res://Assets/CardDB/Broadsword.tres" type="Resource" id=2] [ext_resource path="res://Assets/CardDB/Move.tres" type="Resource" id=2]
[ext_resource path="res://Assets/Metropolis-font/Metropolis-Bold.ttf" type="DynamicFontData" id=3]
[ext_resource path="res://Assets/DiceInput.png" type="Texture" id=4]
[ext_resource path="res://AutoGridContainer - Full Version/AutoGridContainer.tscn" type="PackedScene" id=5]
[ext_resource path="res://Assets/Metropolis-font/Metropolis-Medium.ttf" type="DynamicFontData" id=6]
[sub_resource type="StyleBoxFlat" id=6] [sub_resource type="StyleBoxFlat" id=1]
bg_color = Color( 0.858824, 0.278431, 0.345098, 1 ) bg_color = Color( 0.858824, 0.278431, 0.345098, 1 )
corner_radius_top_left = 20 corner_radius_top_left = 20
corner_radius_top_right = 20 corner_radius_top_right = 20
corner_radius_bottom_right = 20 corner_radius_bottom_right = 20
corner_radius_bottom_left = 20 corner_radius_bottom_left = 20
[sub_resource type="DynamicFontData" id=4]
font_path = "res://Assets/Metropolis-font/Metropolis-Bold.ttf"
[sub_resource type="DynamicFont" id=2]
size = 30
use_filter = true
font_data = SubResource( 4 )
[sub_resource type="DynamicFont" id=7]
size = 64
use_filter = true
font_data = ExtResource( 6 )
[sub_resource type="DynamicFont" id=5]
size = 20
use_filter = true
font_data = ExtResource( 3 )
[node name="Card" type="Control"] [node name="Card" type="Control"]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
margin_right = -741.0
margin_bottom = -227.0
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
script = ExtResource( 1 ) script = ExtResource( 1 )
@ -45,57 +21,4 @@ card_info = ExtResource( 2 )
[node name="PanelContainer" type="PanelContainer" parent="."] [node name="PanelContainer" type="PanelContainer" parent="."]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
custom_styles/panel = SubResource( 6 ) custom_styles/panel = SubResource( 1 )
[node name="VBox" type="VBoxContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 10.0
margin_top = 10.0
margin_right = -10.0
margin_bottom = -10.0
[node name="Name" type="Label" parent="VBox"]
margin_right = 263.0
margin_bottom = 31.0
custom_fonts/font = SubResource( 2 )
text = "The Card Name"
align = 1
autowrap = true
[node name="AutoGrid" parent="VBox" instance=ExtResource( 5 )]
margin_top = 35.0
margin_right = 263.0
margin_bottom = 259.0
[node name="InputDice0" type="TextureRect" parent="VBox/AutoGrid"]
margin_left = 9.0
margin_right = 209.0
margin_bottom = 200.0
rect_min_size = Vector2( 100, 100 )
size_flags_horizontal = 3
size_flags_vertical = 3
texture = ExtResource( 4 )
expand = true
stretch_mode = 6
[node name="Number" type="Label" parent="VBox/AutoGrid/InputDice0"]
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_colors/font_color = Color( 0, 0, 0, 1 )
custom_fonts/font = SubResource( 7 )
align = 1
valign = 1
[node name="Description" type="Label" parent="VBox"]
margin_top = 263.0
margin_right = 263.0
margin_bottom = 353.0
rect_min_size = Vector2( 0, 90 )
custom_fonts/font = SubResource( 5 )
text = "Description"
align = 1
valign = 1
autowrap = true

View File

@ -1,6 +1,10 @@
[gd_scene load_steps=2 format=2] [gd_scene load_steps=6 format=2]
[ext_resource path="res://UI/Card.tscn" type="PackedScene" id=1] [ext_resource path="res://UI/Card.tscn" type="PackedScene" id=1]
[ext_resource path="res://Assets/CardDB/Damage.tres" type="Resource" id=2]
[ext_resource path="res://Assets/DiceInput.png" type="Texture" id=3]
[ext_resource path="res://Assets/Dice/Dice2.png" type="Texture" id=4]
[ext_resource path="res://Assets/CardDB/Effect.tres" type="Resource" id=5]
[node name="CardView" type="Control"] [node name="CardView" type="Control"]
anchor_right = 1.0 anchor_right = 1.0
@ -25,6 +29,7 @@ anchor_bottom = 0.0
margin_left = 274.0 margin_left = 274.0
margin_right = 498.0 margin_right = 498.0
margin_bottom = 323.0 margin_bottom = 323.0
card_info = ExtResource( 2 )
[node name="Card3" parent="HBox" instance=ExtResource( 1 )] [node name="Card3" parent="HBox" instance=ExtResource( 1 )]
anchor_right = 0.0 anchor_right = 0.0
@ -32,3 +37,23 @@ anchor_bottom = 0.0
margin_left = 548.0 margin_left = 548.0
margin_right = 772.0 margin_right = 772.0
margin_bottom = 323.0 margin_bottom = 323.0
card_info = ExtResource( 5 )
[node name="DiceInput" type="Sprite" parent="."]
position = Vector2( 111, 109 )
scale = Vector2( 0.2, 0.2 )
texture = ExtResource( 3 )
[node name="DiceInput2" type="Sprite" parent="."]
position = Vector2( 662, 109 )
scale = Vector2( 0.2, 0.2 )
texture = ExtResource( 3 )
[node name="DiceInput3" type="Sprite" parent="."]
position = Vector2( 387, 108 )
scale = Vector2( 0.2, 0.2 )
texture = ExtResource( 3 )
[node name="Dice2" type="Sprite" parent="DiceInput3"]
position = Vector2( -1390, 15 )
texture = ExtResource( 4 )