gitignore, spring cleaning

This commit is contained in:
Llywelwyn 2023-07-30 01:05:44 +01:00
parent e937994439
commit 3e9ebaa002
5 changed files with 33 additions and 104 deletions

13
.gitignore vendored
View file

@ -1,6 +1,11 @@
/target
.rustfmt.toml
# Build files, documentation, benchmarks
target
docs/*
# VSCode/IDE config files
.vscode/*
docs/gifs/*
.savegames/*
.rustfmt.toml
.prettierignore
# Savegame
savegame.json

View file

@ -1,33 +0,0 @@
AOE { radius: i32 }
BlocksTile {}
CombatStats { max_hp: i32, hp: i32, defence: i32, power: i32 }
Confusion { turns: i32 }
Consumable {}
Cursed {}
DefenceBonus { amount: i32 }
Destructible {}
Equippable { slot: EquipmentSlot }
Equipped { owner: Entity, slot: EquipmentSlot }
HungerClock { state: HungerState, duration: i32 }
InBackpack { owner: Entity }
InflictsDamage { amount: i32 }
Item {}
MagicMapper {}
MeleePowerBonus { amount: i32 }
Mind {}
Monster {}
Name { name: String }
ParticleLifetime { lifetime_ms: f32 }
Player {}
Position { x: i32, y: i32}
ProvidesHealing { amount: i32 }
Ranged { range: i32 }
Renderable { glyph: rltk::FontCharType, fg: RGB, bg: RGB, render_order: i32 }
SufferDamage { amount: i32 }
Telepath { telepath_tiles: Vec<rltk::Point>, range: i32, dirty: bool }
Viewshed { visible_tiles: Vec<rltk::Point>, range: i32, dirty: bool }
WantsToDropItem { item: Entity }
WantsToMelee { target: Entity }
WantsToPickupItem { collected_by: Entity, item: Entity }
WantsToRemoveItem { item: Entity }
WantsToUseItem { item: Entity, target: Option<rltk::Point }

View file

@ -54,9 +54,7 @@
"flags": ["BYSTANDER", "BLOCKS_TILE"],
"vision_range": 4,
"quips": ["You're not borrowing my pick."],
"attacks": [
{ "name": "hits", "hit_bonus": 0, "damage": "1d8"}
]
"attacks": [{ "name": "hits", "hit_bonus": 0, "damage": "1d8" }]
},
{
"id": "npc_guard",
@ -66,9 +64,7 @@
"level": 2,
"vision_range": 4,
"quips": ["You wont catch me down the mine.", "Staying out of trouble?"],
"attacks": [
{ "name": "hits", "hit_bonus": 0, "damage": "1d8"}
],
"attacks": [{ "name": "hits", "hit_bonus": 0, "damage": "1d8" }],
"equipped": ["equip_shortsword", "equip_body_leather"]
},
{
@ -80,9 +76,7 @@
"bac": 6,
"vision_range": 12,
"quips": ["<woof!>", "<bark!>", "<grrr..>"],
"attacks": [
{ "name": "bites", "hit_bonus": 0, "damage": "1d6"}
]
"attacks": [{ "name": "bites", "hit_bonus": 0, "damage": "1d6" }]
},
{
"id": "rat",
@ -91,9 +85,7 @@
"flags": ["MONSTER", "BLOCKS_TILE"],
"bac": 6,
"vision_range": 8,
"attacks": [
{ "name": "bites", "hit_bonus": 0, "damage": "1d2"}
]
"attacks": [{ "name": "bites", "hit_bonus": 0, "damage": "1d2" }]
},
{
"id": "chicken",
@ -102,9 +94,7 @@
"flags": ["BYSTANDER", "BLOCKS_TILE"],
"bac": 8,
"vision_range": 4,
"attacks": [
{ "name": "bites", "hit_bonus": 0, "damage": "1d3"}
]
"attacks": [{ "name": "bites", "hit_bonus": 0, "damage": "1d3" }]
},
{
"id": "chicken_little",
@ -113,9 +103,7 @@
"flags": ["BYSTANDER", "BLOCKS_TILE"],
"bac": 10,
"vision_range": 4,
"attacks": [
{ "name": "bites", "hit_bonus": 0, "damage": "1d2"}
]
"attacks": [{ "name": "bites", "hit_bonus": 0, "damage": "1d2" }]
},
{
"id": "rat_giant",
@ -125,9 +113,7 @@
"level": 1,
"bac": 7,
"vision_range": 8,
"attacks": [
{ "name": "bites", "hit_bonus": 0, "damage": "1d3"}
]
"attacks": [{ "name": "bites", "hit_bonus": 0, "damage": "1d3" }]
},
{
"id": "dog",
@ -137,9 +123,7 @@
"level": 4,
"bac": 5,
"vision_range": 12,
"attacks": [
{ "name": "bites", "hit_bonus": 0, "damage": "1d6"}
]
"attacks": [{ "name": "bites", "hit_bonus": 0, "damage": "1d6" }]
},
{
"id": "dog_large",
@ -149,9 +133,7 @@
"level": 6,
"bac": 4,
"vision_range": 12,
"attacks": [
{ "name": "bites", "hit_bonus": 0, "damage": "2d4"}
]
"attacks": [{ "name": "bites", "hit_bonus": 0, "damage": "2d4" }]
},
{
"id": "goblin",
@ -160,9 +142,7 @@
"flags": ["MONSTER", "BLOCKS_TILE"],
"level": 1,
"vision_range": 12,
"attacks": [
{ "name": "hits", "hit_bonus": 0, "damage": "1d4"}
]
"attacks": [{ "name": "hits", "hit_bonus": 0, "damage": "1d4" }]
},
{
"id": "kobold",
@ -171,9 +151,7 @@
"flags": ["MONSTER", "BLOCKS_TILE"],
"level": 1,
"vision_range": 7,
"attacks": [
{ "name": "hits", "hit_bonus": 0, "damage": "1d4"}
]
"attacks": [{ "name": "hits", "hit_bonus": 0, "damage": "1d4" }]
},
{
"id": "jackal",
@ -182,9 +160,7 @@
"flags": ["MONSTER", "BLOCKS_TILE"],
"bac": 7,
"vision_range": 12,
"attacks": [
{ "name": "bites", "hit_bonus": 0, "damage": "1d2"}
]
"attacks": [{ "name": "bites", "hit_bonus": 0, "damage": "1d2" }]
},
{
"id": "fox",
@ -193,9 +169,7 @@
"flags": ["MONSTER", "BLOCKS_TILE"],
"bac": 7,
"vision_range": 12,
"attacks": [
{ "name": "bites", "hit_bonus": 0, "damage": "1d3"}
]
"attacks": [{ "name": "bites", "hit_bonus": 0, "damage": "1d3" }]
},
{
"id": "coyote",
@ -205,9 +179,7 @@
"level": 1,
"bac": 7,
"vision_range": 12,
"attacks": [
{ "name": "bites", "hit_bonus": 0, "damage": "1d4"}
]
"attacks": [{ "name": "bites", "hit_bonus": 0, "damage": "1d4" }]
},
{
"id": "wolf",
@ -217,9 +189,7 @@
"level": 5,
"bac": 4,
"vision_range": 12,
"attacks": [
{ "name": "bites", "hit_bonus": 0, "damage": "2d4"}
]
"attacks": [{ "name": "bites", "hit_bonus": 0, "damage": "2d4" }]
},
{
"id": "goblin_chieftain",
@ -228,9 +198,7 @@
"flags": ["MONSTER", "BLOCKS_TILE"],
"level": 2,
"vision_range": 12,
"attacks": [
{ "name": "hits", "hit_bonus": 0, "damage": "1d8"}
]
"attacks": [{ "name": "hits", "hit_bonus": 0, "damage": "1d8" }]
},
{
"id": "orc",
@ -238,9 +206,7 @@
"renderable": { "glyph": "o", "fg": "#00FF00", "bg": "#000000", "order": 1 },
"flags": ["MONSTER", "BLOCKS_TILE"],
"vision_range": 12,
"attacks": [
{ "name": "hits", "hit_bonus": 0, "damage": "1d6"}
]
"attacks": [{ "name": "hits", "hit_bonus": 0, "damage": "1d6" }]
},
{
"id": "orc_large",
@ -249,9 +215,7 @@
"flags": ["MONSTER", "BLOCKS_TILE"],
"level": 2,
"vision_range": 12,
"attacks": [
{ "name": "hits", "hit_bonus": 0, "damage": "1d6"}
]
"attacks": [{ "name": "hits", "hit_bonus": 0, "damage": "1d6" }]
},
{
"id": "ogre",

View file

@ -67,21 +67,15 @@
{ "id": "kobold", "weight": 1, "difficulty": 1},
{ "id": "fox", "weight": 1, "difficulty": 1},
{ "id": "jackal", "weight": 4, "difficulty": 1},
{ "id": "rat_giant", "weight": 2, "difficulty": 2},
{ "id": "rat_giant", "weight": 2, "difficulty": 2},
{ "id": "coyote", "weight": 4, "difficulty": 2},
{ "id": "dog_little", "weight": 1, "difficulty": 3},
{ "id": "orc", "weight": 2, "difficulty": 3},
{ "id": "orc_large", "weight": 1, "difficulty": 3},
{ "id": "goblin_chieftain", "weight": 1, "difficulty": 3},
{ "id": "ogre", "weight": 1, "difficulty": 4},
{ "id": "dog", "weight": 1, "difficulty": 5},
{ "id": "wolf", "weight": 2, "difficulty": 6},
{ "id": "dog_large", "weight": 1, "difficulty": 7}
]
},

View file

@ -60,8 +60,6 @@ impl<'a> System<'a> for DamageSystem {
let mut player_stats = stats.get_mut(*player).unwrap();
let player_attributes = attributes.get(*player).unwrap();
player_stats.xp += xp_gain;
rltk::console::log(xp_gain);
let mut next_level_requirement = -1;
if player_stats.level < 10 {
next_level_requirement = 20 * 2_i32.pow(player_stats.level as u32 - 1);
@ -70,7 +68,6 @@ impl<'a> System<'a> for DamageSystem {
} else if player_stats.level < 30 {
next_level_requirement = 10000000 * (player_stats.level - 19);
}
if next_level_requirement != -1 && player_stats.xp >= next_level_requirement {
// We've gone up a level!
player_stats.level += 1;
@ -91,13 +88,14 @@ impl<'a> System<'a> for DamageSystem {
);
}
}
// Roll for HP gain this level
let hp_gained = player_hp_per_level(
&mut rng,
player_attributes.constitution.base + player_attributes.constitution.modifiers,
);
player_stats.hit_points.max += hp_gained;
player_stats.hit_points.current += hp_gained;
// Roll for MANA gain this level
let mana_gained = mana_per_level(
&mut rng,
player_attributes.intelligence.base + player_attributes.intelligence.modifiers,
@ -106,7 +104,7 @@ impl<'a> System<'a> for DamageSystem {
player_stats.mana.current += mana_gained;
}
}
// Clear the queue
damage.clear();
}
}
@ -146,6 +144,7 @@ pub fn delete_the_dead(ecs: &mut World) {
}
dead.push(entity)
}
// The player died, go to GameOver.
Some(_) => {
let mut runstate = ecs.write_resource::<RunState>();
*runstate = RunState::GameOver;
@ -154,7 +153,7 @@ pub fn delete_the_dead(ecs: &mut World) {
}
}
}
// For everything that died, increment the event log, and delete.
for victim in dead {
gamelog::record_event("death_count", 1);
ecs.delete_entity(victim).expect("Unable to delete.");