rename stuff
This commit is contained in:
parent
39957c0380
commit
61870b69ac
@ -464,14 +464,14 @@ impl Game {
|
||||
}
|
||||
|
||||
fn resolve(&mut self, cast: Cast) -> &mut Game {
|
||||
let casts = self.finalise_casts(cast);
|
||||
let casts = self.modify_cast(cast);
|
||||
for cast in casts {
|
||||
self.execute(cast);
|
||||
}
|
||||
self
|
||||
}
|
||||
|
||||
fn finalise_casts(&self, cast: Cast) -> Vec<Cast> {
|
||||
fn modify_cast(&self, cast: Cast) -> Vec<Cast> {
|
||||
let target_player = self.players.iter()
|
||||
.find(|t| t.constructs.iter().any(|c| c.id == cast.target))
|
||||
.unwrap();
|
||||
@ -512,12 +512,12 @@ impl Game {
|
||||
Action::Hit => self.hit(cast),
|
||||
|
||||
Action::Damage { construct, values, colour } => {
|
||||
let amount = self.calculate_amount(&values, &event_list);
|
||||
let amount = self.reduce_values(&values, &event_list);
|
||||
self.damage(construct, amount, colour)
|
||||
},
|
||||
|
||||
Action::Heal { construct, values, colour } => {
|
||||
let amount = self.calculate_amount(&values, &event_list);
|
||||
let amount = self.reduce_values(&values, &event_list);
|
||||
self.heal(construct, amount, colour)
|
||||
},
|
||||
|
||||
@ -601,7 +601,7 @@ impl Game {
|
||||
self
|
||||
}
|
||||
|
||||
fn calculate_amount(&mut self, values: &Vec<Value>, events: &Vec<Event>) -> usize {
|
||||
fn reduce_values(&mut self, values: &Vec<Value>, events: &Vec<Event>) -> usize {
|
||||
values.iter()
|
||||
.fold(0, |total, value| {
|
||||
total + match value {
|
||||
@ -616,6 +616,9 @@ impl Game {
|
||||
self.construct_by_id(*construct).unwrap().effects.len().pct(*mult),
|
||||
|
||||
Value::ColourSkills { construct, colour, mult } => unimplemented!(),
|
||||
self.construct_by_id(*construct).unwrap().skills.iter()
|
||||
.filter(|ce| ce.)
|
||||
.count(),
|
||||
|
||||
Value::DamageTaken { construct, colour, mult } =>
|
||||
events.iter().fold(0, |dmg, e| match e {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user