More feedback addressed (no assets).

This commit is contained in:
Sam 2022-05-09 21:05:10 -04:00
parent 5d0ba6e2b8
commit 00276acbdb
5 changed files with 21 additions and 13 deletions

View File

@ -73,7 +73,7 @@ fn armor_stats() -> Result<(), Box<dyn Error>> {
wtr.write_record(&[ wtr.write_record(&[
item.item_definition_id() item.item_definition_id()
.raw() .itemdef_id()
.expect("All items from asset glob should be simple items"), .expect("All items from asset glob should be simple items"),
&kind, &kind,
&item.name(), &item.name(),
@ -134,7 +134,7 @@ fn weapon_stats() -> Result<(), Box<dyn Error>> {
wtr.write_record(&[ wtr.write_record(&[
item.item_definition_id() item.item_definition_id()
.raw() .itemdef_id()
.expect("All items from asset glob should be simple items"), .expect("All items from asset glob should be simple items"),
&kind, &kind,
&item.name(), &item.name(),
@ -233,7 +233,7 @@ fn all_items() -> Result<(), Box<dyn Error>> {
wtr.write_record(&[ wtr.write_record(&[
item.item_definition_id() item.item_definition_id()
.raw() .itemdef_id()
.expect("All items in asset glob should be simple items"), .expect("All items in asset glob should be simple items"),
&item.name(), &item.name(),
&kind, &kind,

View File

@ -236,7 +236,7 @@ fn armor_stats() -> Result<(), Box<dyn Error>> {
let mut path = ASSETS_PATH.clone(); let mut path = ASSETS_PATH.clone();
for part in item for part in item
.item_definition_id() .item_definition_id()
.raw() .itemdef_id()
.expect("Csv import only works on simple items, not modular items") .expect("Csv import only works on simple items, not modular items")
.split('.') .split('.')
{ {
@ -435,7 +435,7 @@ fn weapon_stats() -> Result<(), Box<dyn Error>> {
let mut path = ASSETS_PATH.clone(); let mut path = ASSETS_PATH.clone();
for part in item for part in item
.item_definition_id() .item_definition_id()
.raw() .itemdef_id()
.expect("Csv import only works on simple items, not modular items") .expect("Csv import only works on simple items, not modular items")
.split('.') .split('.')
{ {

View File

@ -25,7 +25,7 @@ fn main() {
.output .output
.0 .0
.item_definition_id() .item_definition_id()
.raw() .itemdef_id()
.expect("Recipe book can only create simple items (probably)"), .expect("Recipe book can only create simple items (probably)"),
); );
let inputs = recipe let inputs = recipe
@ -34,7 +34,7 @@ fn main() {
.map(|(i, _, _)| i) .map(|(i, _, _)| i)
.filter_map(|input| { .filter_map(|input| {
if let RecipeInput::Item(item) = input { if let RecipeInput::Item(item) = input {
item.item_definition_id().raw().map(String::from) item.item_definition_id().itemdef_id().map(String::from)
} else { } else {
None None
} }

View File

@ -1002,9 +1002,7 @@ impl CharacterAbility {
duration: _, duration: _,
category: _, category: _,
}| { }| {
// Do we want to make buff_strength affect this instead of power? *strength *= stats.diminished_buff_strength();
// Look into during modular weapon transition
*strength *= stats.buff_strength * stats.power;
}, },
); );
*range *= stats.range; *range *= stats.range;
@ -1044,9 +1042,7 @@ impl CharacterAbility {
buff_duration: _, buff_duration: _,
ref mut energy_cost, ref mut energy_cost,
} => { } => {
// Do we want to make buff_strength affect this instead of power? *buff_strength *= stats.diminished_buff_strength();
// Look into during modular weapon transition
*buff_strength *= stats.buff_strength * stats.power;
*buildup_duration /= stats.speed; *buildup_duration /= stats.speed;
*cast_duration /= stats.speed; *cast_duration /= stats.speed;
*recover_duration /= stats.speed; *recover_duration /= stats.speed;

View File

@ -131,6 +131,18 @@ impl Stats {
buff_strength: 1.0, buff_strength: 1.0,
} }
} }
/// Calculates a diminished buff strength where the buff strength is clamped
/// by the power, and then excess buff strength above the power is added
/// with diminishing returns.
// TODO: Remove this later when there are more varied high tier materials.
// Mainly exists for now as a hack to allow some progression in strength of
// directly applied buffs.
pub fn diminished_buff_strength(&self) -> f32 {
let base = self.buff_strength.clamp(0.0, self.power);
let diminished = (self.buff_strength - base + 1.0).log(5.0);
base + diminished
}
} }
impl Asset for Stats { impl Asset for Stats {