fix vbox not recalculating on spec remove
This commit is contained in:
@@ -638,6 +638,20 @@ pub fn vbox_unequip(params: VboxUnequipParams, tx: &mut Transaction, account: &A
|
||||
None => return Err(err_msg("var has no effect on cryps")),
|
||||
}
|
||||
|
||||
// now the var has been applied
|
||||
// recalculate the stats of the whole team
|
||||
let team_colours = player.cryps.iter().fold(Colours::new(), |tc, c| {
|
||||
Colours {
|
||||
red: tc.red + c.colours.red,
|
||||
green: tc.green + c.colours.green,
|
||||
blue: tc.blue + c.colours.blue
|
||||
}
|
||||
});
|
||||
|
||||
for cryp in player.cryps.iter_mut() {
|
||||
cryp.apply_modifiers(&team_colours);
|
||||
}
|
||||
|
||||
player.vbox.bound.push(params.target);
|
||||
return player_update(tx, player, false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user