Add creature spawn chance

This commit is contained in:
Em (Ethan) Ruszanowski 2024-03-01 14:44:37 -05:00
parent 28b162fb0f
commit 31ff9e346b
Signed by: em
GPG key ID: C725D6E571252B96
4 changed files with 197 additions and 43 deletions

View file

@ -1,54 +1,53 @@
create table creature_type
(
creature_type_id int
primary key,
type_name text not null
creature_type_id int,
type_name text not null,
primary key (creature_type_id)
);
create table layout
(
layout_id int
primary key,
layout_name text not null
layout_id int,
layout_name text not null,
primary key (layout_id)
);
create table moon_tier
(
moon_tier_id int
primary key,
tier_name text not null
moon_tier_id int,
tier_name text not null,
primary key (moon_tier_id)
);
create table risk_level
(
risk_level_id int
primary key,
risk_level_name text not null
risk_level_id int,
risk_level_name text not null,
primary key (risk_level_id)
);
create table moon
(
moon_id int
primary key,
moon_id int,
moon_name text not null,
risk_level_id int not null
references risk_level,
risk_level_id int not null,
cost int not null,
default_layout_id int not null
references layout,
default_layout_id int not null,
map_size_multiplier real not null,
min_scrap int not null,
max_scrap int not null,
outside_max_power int not null,
inside_max_power int not null,
moon_tier_id int not null
references moon_tier
moon_tier_id int not null,
primary key (moon_id),
foreign key (risk_level_id) references risk_level,
foreign key (default_layout_id) references layout,
foreign key (moon_tier_id) references moon_tier
);
create table creature
(
creature_id int
primary key,
creature_id int,
creature_name text not null,
creature_nickname text,
health int,
@ -58,47 +57,48 @@ create table creature
stun_multiplier real,
door_open_speed real,
hostile int not null,
creature_type_id int not null
references creature_type,
favorite_moon_id int not null
references moon
creature_type_id int not null,
favorite_moon_id int not null,
primary key (creature_id),
foreign key (creature_type_id) references creature_type,
foreign key (favorite_moon_id) references moon
);
create table scrap
(
scrap_id int
primary key,
scrap_id int,
scrap_name text not null,
min_value int not null,
max_value int not null,
weight int not null,
conductive int not null,
two_handed int not null
two_handed int not null,
primary key (scrap_id)
);
create table spawn_chance
(
moon_id int not null
references moon,
creature_id int not null
references creature,
spawn_chance real not null
moon_id int not null,
creature_id int not null,
spawn_chance real not null,
foreign key (moon_id) references moon,
foreign key (creature_id) references creature
);
create table weather
(
weather_id int
primary key,
weather_id int,
weather_name text not null,
effect text
effect text,
primary key (weather_id)
);
create table viable_weather
(
moon_id int not null
references moon,
weather_id int not null
references weather
moon_id int not null,
weather_id int not null,
foreign key (moon_id) references moon,
foreign key (weather_id) references weather
);

View file

@ -1 +1,153 @@
;
insert into main.spawn_chance (moon_id, creature_id, spawn_chance)
values (1, 10, 0),
(1, 11, 0),
(1, 12, 0),
(1, 14, 0),
(1, 16, 0),
(1, 7, 0.44),
(1, 9, 0.44),
(1, 4, 5.73),
(1, 5, 7.05),
(1, 3, 12.33),
(1, 8, 12.33),
(1, 6, 13.66),
(1, 17, 14.86),
(1, 1, 22.47),
(1, 2, 25.55),
(1, 19, 35.14),
(1, 15, 42.75),
(1, 18, 50),
(1, 13, 57.25),
(2, 10, 0),
(2, 11, 0),
(2, 12, 0),
(2, 14, 0.52),
(2, 16, 10.31),
(2, 7, 0.31),
(2, 9, 0.31),
(2, 4, 4.35),
(2, 5, 7.45),
(2, 3, 24.22),
(2, 8, 4.35),
(2, 6, 8.7),
(2, 17, 21.39),
(2, 1, 28.88),
(2, 2, 21.43),
(2, 19, 28.86),
(2, 15, 48.97),
(2, 18, 49.75),
(2, 13, 40.21),
(3, 10, 1.96),
(3, 11, 0),
(3, 12, 0),
(3, 14, 65.36),
(3, 16, 20.26),
(3, 7, 0),
(3, 9, 0),
(3, 4, 26.14),
(3, 5, 2.94),
(3, 3, 20.59),
(3, 8, 6.21),
(3, 6, 9.15),
(3, 17, 26.75),
(3, 1, 19.93),
(3, 2, 13.07),
(3, 19, 29.39),
(3, 15, 11.76),
(3, 18, 43.86),
(3, 13, 2.61),
(4, 10, 11.85),
(4, 11, 0),
(4, 12, 0),
(4, 14, 4.37),
(4, 16, 29.13),
(4, 7, 0),
(4, 9, 0.95),
(4, 4, 1.42),
(4, 5, 26.07),
(4, 3, 7.58),
(4, 8, 3.32),
(4, 6, 15.17),
(4, 17, 0),
(4, 1, 12.8),
(4, 2, 20.85),
(4, 19, 0),
(4, 15, 17.96),
(4, 18, 100),
(4, 13, 48.54),
(5, 10, 3.27),
(5, 11, 0.33),
(5, 12, 0),
(5, 14, 31.53),
(5, 16, 41.87),
(5, 7, 0),
(5, 9, 0.98),
(5, 4, 18.3),
(5, 5, 24.18),
(5, 3, 11.76),
(5, 8, 2.94),
(5, 6, 4.9),
(5, 17, 35.29),
(5, 1, 12.42),
(5, 2, 20.92),
(5, 19, 24.02),
(5, 15, 7.88),
(5, 18, 40.69),
(5, 13, 18.72),
(6, 10, 11.14),
(6, 11, 15.54),
(6, 12, 6.48),
(6, 14, 39.47),
(6, 16, 0),
(6, 7, 5.18),
(6, 9, 25.91),
(6, 4, 13.21),
(6, 5, 0),
(6, 3, 0),
(6, 8, 1.81),
(6, 6, 1.55),
(6, 17, 0),
(6, 1, 8.03),
(6, 2, 11.14),
(6, 19, 0),
(6, 15, 11.84),
(6, 18, 0),
(6, 13, 48.68),
(7, 10, 10.84),
(7, 11, 13.5),
(7, 12, 0),
(7, 14, 17.07),
(7, 16, 0),
(7, 7, 3.68),
(7, 9, 12.27),
(7, 4, 5.11),
(7, 5, 9.82),
(7, 3, 9.82),
(7, 8, 3.27),
(7, 6, 7.98),
(7, 17, 0),
(7, 1, 10.63),
(7, 2, 13.09),
(7, 19, 0),
(7, 15, 34.76),
(7, 18, 0),
(7, 13, 48.17),
(8, 10, 10.46),
(8, 11, 12.59),
(8, 12, 5.67),
(8, 14, 27.59),
(8, 16, 0),
(8, 7, 4.96),
(8, 9, 12.59),
(8, 4, 10.99),
(8, 5, 9.57),
(8, 3, 6.74),
(8, 8, 2.84),
(8, 6, 3.55),
(8, 17, 0),
(8, 1, 9.57),
(8, 2, 10.46),
(8, 19, 0),
(8, 15, 3.45),
(8, 18, 0),
(8, 13, 68.97);

View file

@ -73,7 +73,9 @@ def get_moon_list() -> list[str] | None:
with get_connection() as connection:
cursor = connection.cursor()
moon_names = cursor.execute(
"select moon_name from moon order by moon_id"
"select moon_name "
"from moon "
"order by moon_id;"
).fetchall()
if moon_names:

Binary file not shown.