sorry - swapping from rustfmt to prettier-rust
This commit is contained in:
parent
281396f9ce
commit
c2c7e0bd52
93 changed files with 2797 additions and 2021 deletions
|
|
@ -1,8 +1,15 @@
|
|||
use super::{add_effect, targeting, EffectSpawner, EffectType, Entity, Targets, World};
|
||||
use super::{ add_effect, targeting, EffectSpawner, EffectType, Entity, Targets, World };
|
||||
use crate::{
|
||||
gamelog,
|
||||
gamesystem::{hp_per_level, mana_per_level},
|
||||
Attributes, Confusion, Destructible, GrantsXP, Map, Player, Pools, DEFAULT_PARTICLE_LIFETIME,
|
||||
gamesystem::{ hp_per_level, mana_per_level },
|
||||
Attributes,
|
||||
Confusion,
|
||||
Destructible,
|
||||
GrantsXP,
|
||||
Map,
|
||||
Player,
|
||||
Pools,
|
||||
DEFAULT_PARTICLE_LIFETIME,
|
||||
LONG_PARTICLE_LIFETIME,
|
||||
};
|
||||
use rltk::prelude::*;
|
||||
|
|
@ -24,7 +31,7 @@ pub fn inflict_damage(ecs: &mut World, damage: &EffectSpawner, target: Entity) {
|
|||
lifespan: DEFAULT_PARTICLE_LIFETIME,
|
||||
delay: 0.0,
|
||||
},
|
||||
Targets::Entity { target },
|
||||
Targets::Entity { target }
|
||||
);
|
||||
if target_pool.hit_points.current < 1 {
|
||||
super::DEAD_ENTITIES.lock().unwrap().push_back(target);
|
||||
|
|
@ -57,7 +64,7 @@ pub fn heal_damage(ecs: &mut World, heal: &EffectSpawner, target: Entity) {
|
|||
lifespan: DEFAULT_PARTICLE_LIFETIME,
|
||||
delay: 0.0,
|
||||
},
|
||||
Targets::Entity { target },
|
||||
Targets::Entity { target }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -98,7 +105,7 @@ pub fn bloodstain(ecs: &mut World, target: usize) {
|
|||
// - If we're in bounds and the tile is unbloodied, bloody it and return.
|
||||
// - If we ever leave bounds, return.
|
||||
// - Roll a dice on each failed attempt, with an increasing change to return (soft-capping max spread)
|
||||
if spread > 0 && spread < (map.height * map.width) {
|
||||
if spread > 0 && spread < map.height * map.width {
|
||||
if !map.bloodstains.contains(&(spread as usize)) {
|
||||
map.bloodstains.insert(spread as usize);
|
||||
return;
|
||||
|
|
@ -117,9 +124,9 @@ fn get_next_level_requirement(level: i32) -> i32 {
|
|||
if level == 0 {
|
||||
return 5;
|
||||
} else if level < 10 {
|
||||
return 20 * 2_i32.pow(level as u32 - 1);
|
||||
return 20 * (2_i32).pow((level as u32) - 1);
|
||||
} else if level < 20 {
|
||||
return 10000 * 2_i32.pow(level as u32 - 10);
|
||||
return 10000 * (2_i32).pow((level as u32) - 10);
|
||||
} else if level < 30 {
|
||||
return 10000000 * (level - 19);
|
||||
}
|
||||
|
|
@ -155,7 +162,8 @@ pub fn entity_death(ecs: &mut World, effect: &EffectSpawner, target: Entity) {
|
|||
// If it was the PLAYER that levelled up:
|
||||
if ecs.read_storage::<Player>().get(source).is_some() {
|
||||
gamelog::record_event("player_level", 1);
|
||||
gamelog::Logger::new()
|
||||
gamelog::Logger
|
||||
::new()
|
||||
.append("Welcome to experience level")
|
||||
.append(source_pools.level)
|
||||
.append(".")
|
||||
|
|
@ -171,9 +179,9 @@ pub fn entity_death(ecs: &mut World, effect: &EffectSpawner, target: Entity) {
|
|||
fg: RGB::named(GOLD),
|
||||
bg: RGB::named(BLACK),
|
||||
lifespan: LONG_PARTICLE_LIFETIME,
|
||||
delay: i as f32 * 100.0,
|
||||
delay: (i as f32) * 100.0,
|
||||
},
|
||||
Targets::Tile { target: map.xy_idx(player_pos.x, player_pos.y - i) },
|
||||
Targets::Tile { target: map.xy_idx(player_pos.x, player_pos.y - i) }
|
||||
);
|
||||
if i > 2 {
|
||||
add_effect(
|
||||
|
|
@ -183,9 +191,9 @@ pub fn entity_death(ecs: &mut World, effect: &EffectSpawner, target: Entity) {
|
|||
fg: RGB::named(GOLD),
|
||||
bg: RGB::named(BLACK),
|
||||
lifespan: LONG_PARTICLE_LIFETIME,
|
||||
delay: i as f32 * 100.0,
|
||||
delay: (i as f32) * 100.0,
|
||||
},
|
||||
Targets::Tile { target: map.xy_idx(player_pos.x + (i - 2), player_pos.y - i) },
|
||||
Targets::Tile { target: map.xy_idx(player_pos.x + (i - 2), player_pos.y - i) }
|
||||
);
|
||||
add_effect(
|
||||
None,
|
||||
|
|
@ -194,9 +202,9 @@ pub fn entity_death(ecs: &mut World, effect: &EffectSpawner, target: Entity) {
|
|||
fg: RGB::named(GOLD),
|
||||
bg: RGB::named(BLACK),
|
||||
lifespan: LONG_PARTICLE_LIFETIME,
|
||||
delay: i as f32 * 100.0,
|
||||
delay: (i as f32) * 100.0,
|
||||
},
|
||||
Targets::Tile { target: map.xy_idx(player_pos.x - (i - 2), player_pos.y - i) },
|
||||
Targets::Tile { target: map.xy_idx(player_pos.x - (i - 2), player_pos.y - i) }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -208,11 +216,11 @@ pub fn entity_death(ecs: &mut World, effect: &EffectSpawner, target: Entity) {
|
|||
let mut rng = ecs.write_resource::<RandomNumberGenerator>();
|
||||
let hp_gained = hp_per_level(
|
||||
&mut rng,
|
||||
source_attributes.constitution.base + source_attributes.constitution.modifiers,
|
||||
source_attributes.constitution.base + source_attributes.constitution.modifiers
|
||||
);
|
||||
let mana_gained = mana_per_level(
|
||||
&mut rng,
|
||||
source_attributes.intelligence.base + source_attributes.intelligence.modifiers,
|
||||
source_attributes.intelligence.base + source_attributes.intelligence.modifiers
|
||||
);
|
||||
source_pools.hit_points.max += hp_gained;
|
||||
source_pools.hit_points.current += hp_gained;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue