Skip to content

Commit

Permalink
rebalanced weight
Browse files Browse the repository at this point in the history
  • Loading branch information
memoryleak47 committed Oct 10, 2020
1 parent 1566331 commit 35b2736
Show file tree
Hide file tree
Showing 12 changed files with 14 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl UnitCommand {
UnitCommand::Move(dir) => {
let to = pos.map(|x| x + **dir).unwrap();
let terrain_summand = stamina_cost_at(pos, w) + stamina_cost_at(to, w);
let weight_summand = w.unitmap.get(pos).unwrap().get_weight() / 5;
let weight_summand = w.unitmap.get(pos).unwrap().get_weight();
terrain_summand + weight_summand
},
UnitCommand::Attack(..) => { 10 },
Expand All @@ -46,7 +46,7 @@ impl UnitCommand {
.nth(*i)
.unwrap()
.get_class()
.get_weight() / 2
.get_weight()
},
UnitCommand::BurnBuilding => 0,
UnitCommand::Craft(_) => 0,
Expand Down
2 changes: 1 addition & 1 deletion src/item/food.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ impl ItemClassTrait for FoodClass {
type Instance = Food;

fn get_name() -> &'static str { "Food" }
fn get_weight() -> u32 { 2 }
fn get_weight() -> u32 { 1 }
fn build() -> Item {
Item::Food(Food)
}
Expand Down
2 changes: 1 addition & 1 deletion src/item/iron.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ impl ItemClassTrait for IronClass {
type Instance = Iron;

fn get_name() -> &'static str { "Iron" }
fn get_weight() -> u32 { 10 }
fn get_weight() -> u32 { 3 }
fn build() -> Item {
Item::Iron(Iron)
}
Expand Down
2 changes: 1 addition & 1 deletion src/item/iron_sword.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ impl ItemClassTrait for IronSwordClass {
type Instance = IronSword;

fn get_name() -> &'static str { "IronSword" }
fn get_weight() -> u32 { 40 }
fn get_weight() -> u32 { 20 }
fn build() -> Item {
Item::IronSword(IronSword { health: 100 })
}
Expand Down
2 changes: 1 addition & 1 deletion src/item/lance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ impl ItemClassTrait for LanceClass {
type Instance = Lance;

fn get_name() -> &'static str { "Lance" }
fn get_weight() -> u32 { 40 }
fn get_weight() -> u32 { 20 }
fn build() -> Item {
Item::Lance(Lance { health: 100 })
}
Expand Down
2 changes: 1 addition & 1 deletion src/item/long_sword.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ impl ItemClassTrait for LongSwordClass {
type Instance = LongSword;

fn get_name() -> &'static str { "LongSword" }
fn get_weight() -> u32 { 40 }
fn get_weight() -> u32 { 20 }
fn build() -> Item {
Item::LongSword(LongSword { health: 100 })
}
Expand Down
2 changes: 1 addition & 1 deletion src/item/settlement_kit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ impl ItemClassTrait for SettlementKitClass {
type Instance = SettlementKit;

fn get_name() -> &'static str { "SettlementKit" }
fn get_weight() -> u32 { 100 }
fn get_weight() -> u32 { 20 }
fn build() -> Item {
Item::SettlementKit(SettlementKit)
}
Expand Down
2 changes: 1 addition & 1 deletion src/item/stone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ impl ItemClassTrait for StoneClass {
type Instance = Stone;

fn get_name() -> &'static str { "Stone" }
fn get_weight() -> u32 { 10 }
fn get_weight() -> u32 { 3 }
fn build() -> Item {
Item::Stone(Stone)
}
Expand Down
2 changes: 1 addition & 1 deletion src/item/wood.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ impl ItemClassTrait for WoodClass {
type Instance = Wood;

fn get_name() -> &'static str { "Wood" }
fn get_weight() -> u32 { 4 }
fn get_weight() -> u32 { 2 }
fn build() -> Item {
Item::Wood(Wood)
}
Expand Down
2 changes: 1 addition & 1 deletion src/item/wood_bow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ impl ItemClassTrait for WoodBowClass {
type Instance = WoodBow;

fn get_name() -> &'static str { "WoodBow" }
fn get_weight() -> u32 { 15 }
fn get_weight() -> u32 { 10 }
fn build() -> Item {
Item::WoodBow(WoodBow { health: 100 })
}
Expand Down
2 changes: 1 addition & 1 deletion src/item/wood_sword.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ impl ItemClassTrait for WoodSwordClass {
type Instance = WoodSword;

fn get_name() -> &'static str { "WoodSword" }
fn get_weight() -> u32 { 15 }
fn get_weight() -> u32 { 10 }
fn build() -> Item {
Item::WoodSword(WoodSword { health: 100 })
}
Expand Down
3 changes: 2 additions & 1 deletion src/world/unitmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ impl World {
fn reduce_food(&mut self) {
for p in Pos::iter_all() {
if let Some(ref mut unit) = self.unitmap.get_mut(p) {
unit.food = unit.food.saturating_sub(FOOD_PER_TURN);
let food_reduct = FOOD_PER_TURN + 2 * unit.get_weight() / 10;
unit.food = unit.food.saturating_sub(food_reduct);
}
}
}
Expand Down

0 comments on commit 35b2736

Please sign in to comment.