reorder
This commit is contained in:
parent
006a670027
commit
39957c0380
@ -487,7 +487,7 @@ impl Game {
|
|||||||
// ];
|
// ];
|
||||||
// }
|
// }
|
||||||
|
|
||||||
let targets = match cast.skill.aoe() {
|
let casts = match cast.skill.aoe() {
|
||||||
true => self.players.iter()
|
true => self.players.iter()
|
||||||
.find(|t| t.constructs.iter().any(|c| c.id == cast.target))
|
.find(|t| t.constructs.iter().any(|c| c.id == cast.target))
|
||||||
.unwrap()
|
.unwrap()
|
||||||
@ -500,47 +500,7 @@ impl Game {
|
|||||||
|
|
||||||
// check for reflect
|
// check for reflect
|
||||||
|
|
||||||
return targets;
|
return casts;
|
||||||
}
|
|
||||||
|
|
||||||
fn calculate_amount(&mut self, values: &Vec<Value>, events: &Vec<Event>) -> usize {
|
|
||||||
values.iter()
|
|
||||||
.fold(0, |total, value| {
|
|
||||||
total + match value {
|
|
||||||
Value::Stat { construct, stat, mult } =>
|
|
||||||
self.construct_by_id(*construct).unwrap().stat(*stat).pct(*mult),
|
|
||||||
|
|
||||||
Value::Fixed { value } => *value,
|
|
||||||
|
|
||||||
Value::Cooldowns { construct, mult } => unimplemented!(),
|
|
||||||
|
|
||||||
Value::Effects { construct, mult } =>
|
|
||||||
self.construct_by_id(*construct).unwrap().effects.len().pct(*mult),
|
|
||||||
|
|
||||||
Value::ColourSkills { construct, colour, mult } => unimplemented!(),
|
|
||||||
|
|
||||||
Value::DamageTaken { construct, colour, mult } =>
|
|
||||||
events.iter().fold(0, |dmg, e| match e {
|
|
||||||
Event::Damage { construct: event_construct, amount, mitigation:_, colour: event_colour, display: _ } =>
|
|
||||||
match *construct == *event_construct && *colour == *event_colour {
|
|
||||||
true => dmg + amount.pct(*mult),
|
|
||||||
false => dmg,
|
|
||||||
}
|
|
||||||
_ => dmg,
|
|
||||||
}),
|
|
||||||
|
|
||||||
Value::Removals { construct, mult } =>
|
|
||||||
events.iter().fold(0, |dmg, e| match e {
|
|
||||||
Event::Damage { construct: event_construct, amount, mitigation:_, colour: event_colour, display: _ } =>
|
|
||||||
match *construct == *event_construct {
|
|
||||||
true => dmg + amount.pct(*mult),
|
|
||||||
false => dmg,
|
|
||||||
}
|
|
||||||
_ => dmg,
|
|
||||||
}),
|
|
||||||
// Skills { construct: Uuid, colour: Colour },
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn execute(&mut self, cast: Cast) -> &mut Game {
|
fn execute(&mut self, cast: Cast) -> &mut Game {
|
||||||
@ -641,6 +601,46 @@ impl Game {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn calculate_amount(&mut self, values: &Vec<Value>, events: &Vec<Event>) -> usize {
|
||||||
|
values.iter()
|
||||||
|
.fold(0, |total, value| {
|
||||||
|
total + match value {
|
||||||
|
Value::Stat { construct, stat, mult } =>
|
||||||
|
self.construct_by_id(*construct).unwrap().stat(*stat).pct(*mult),
|
||||||
|
|
||||||
|
Value::Fixed { value } => *value,
|
||||||
|
|
||||||
|
Value::Cooldowns { construct, mult } => unimplemented!(),
|
||||||
|
|
||||||
|
Value::Effects { construct, mult } =>
|
||||||
|
self.construct_by_id(*construct).unwrap().effects.len().pct(*mult),
|
||||||
|
|
||||||
|
Value::ColourSkills { construct, colour, mult } => unimplemented!(),
|
||||||
|
|
||||||
|
Value::DamageTaken { construct, colour, mult } =>
|
||||||
|
events.iter().fold(0, |dmg, e| match e {
|
||||||
|
Event::Damage { construct: event_construct, amount, mitigation:_, colour: event_colour, display: _ } =>
|
||||||
|
match *construct == *event_construct && *colour == *event_colour {
|
||||||
|
true => dmg + amount.pct(*mult),
|
||||||
|
false => dmg,
|
||||||
|
}
|
||||||
|
_ => dmg,
|
||||||
|
}),
|
||||||
|
|
||||||
|
Value::Removals { construct, mult } =>
|
||||||
|
events.iter().fold(0, |dmg, e| match e {
|
||||||
|
Event::Damage { construct: event_construct, amount, mitigation:_, colour: event_colour, display: _ } =>
|
||||||
|
match *construct == *event_construct {
|
||||||
|
true => dmg + amount.pct(*mult),
|
||||||
|
false => dmg,
|
||||||
|
}
|
||||||
|
_ => dmg,
|
||||||
|
}),
|
||||||
|
// Skills { construct: Uuid, colour: Colour },
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
fn cast(&mut self, cast: Cast) -> Vec<Event> {
|
fn cast(&mut self, cast: Cast) -> Vec<Event> {
|
||||||
vec![Event::Cast { construct: cast.source, player: cast.player, direction: self.direction(cast) }]
|
vec![Event::Cast { construct: cast.source, player: cast.player, direction: self.direction(cast) }]
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user