fix purge
This commit is contained in:
parent
6b84fe92d7
commit
fe04c0d2db
@ -132,12 +132,12 @@ impl Events {
|
||||
},
|
||||
|
||||
Event::Subscribe(id, obj) => {
|
||||
info!("subscribe id={:?} object={:?}", id, obj);
|
||||
trace!("subscribe id={:?} object={:?}", id, obj);
|
||||
|
||||
match self.clients.get_mut(&id) {
|
||||
Some(client) => {
|
||||
client.subs.insert(obj);
|
||||
info!("client={:?} subscriptions={:?}", id, client.subs.len());
|
||||
trace!("client={:?} subscriptions={:?}", id, client.subs.len());
|
||||
Ok(())
|
||||
},
|
||||
None => return Err(format_err!("unknown client {:?}", id))
|
||||
@ -145,12 +145,12 @@ impl Events {
|
||||
},
|
||||
|
||||
Event::Unsubscribe(id, obj) => {
|
||||
info!("unsubscribe id={:?} object={:?}", id, obj);
|
||||
trace!("unsubscribe id={:?} object={:?}", id, obj);
|
||||
|
||||
match self.clients.get_mut(&id) {
|
||||
Some(mut client) => {
|
||||
client.subs.remove(&obj);
|
||||
info!("unsubscribe subscriptions removed={:?}", client.subs.len());
|
||||
trace!("unsubscribe subscriptions removed={:?}", client.subs.len());
|
||||
Ok(())
|
||||
},
|
||||
None => return Err(format_err!("unknown client {:?}", id))
|
||||
@ -158,7 +158,7 @@ impl Events {
|
||||
},
|
||||
|
||||
Event::Push(id, msg) => {
|
||||
info!("push id={:?}", id);
|
||||
trace!("push id={:?}", id);
|
||||
|
||||
let mut subs = 0;
|
||||
let mut dead = vec![];
|
||||
@ -177,11 +177,11 @@ impl Events {
|
||||
}
|
||||
|
||||
if !dead.is_empty() {
|
||||
info!("dead connections={:?}", dead.len());
|
||||
trace!("dead connections={:?}", dead.len());
|
||||
dead.iter().for_each(|id| self.remove_client(*id));
|
||||
}
|
||||
|
||||
info!("push subscribers={:?}", subs);
|
||||
trace!("push subscribers={:?}", subs);
|
||||
|
||||
Ok(())
|
||||
},
|
||||
|
||||
@ -1758,17 +1758,16 @@ fn purge(source: &mut Construct, target: &mut Construct, mut results: Resolution
|
||||
.event(Event::Removal { effect: ce.effect, construct_effects: target.effects.clone() }));
|
||||
}
|
||||
|
||||
let mut turns = 0;
|
||||
let mut turns = 1;
|
||||
for cs in target.skills.iter_mut() {
|
||||
if Effect::Purge.disables_skill(cs.skill) {
|
||||
turns += 1;
|
||||
}
|
||||
}
|
||||
if turns > 0 {
|
||||
let mut effect = skill.effect()[0];
|
||||
effect.duration = effect.duration * turns;
|
||||
results.push(Resolution::new(source, target).event(target.add_effect(skill, effect)).stages(EventStages::PostOnly));
|
||||
}
|
||||
|
||||
let mut effect = skill.effect()[0];
|
||||
effect.duration = effect.duration * turns;
|
||||
results.push(Resolution::new(source, target).event(target.add_effect(skill, effect)).stages(EventStages::PostOnly));
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user