Applies a single delta to this GameWorld.
(&mut self, delta: &Delta)
| 2210 | |
| 2211 | /// Applies a single delta to this GameWorld. |
| 2212 | pub(crate) fn apply(&mut self, delta: &Delta) -> Result<(), GameError> { |
| 2213 | match *delta { |
| 2214 | Delta::Attack {robot_id, target_unit_id} => self.attack(robot_id, target_unit_id), |
| 2215 | Delta::BeginSnipe {ranger_id, location} => self.begin_snipe(ranger_id, location), |
| 2216 | Delta::Blueprint {worker_id, structure_type, direction} => self.blueprint(worker_id, structure_type, direction), |
| 2217 | Delta::Blink {mage_id, location} => self.blink(mage_id, location), |
| 2218 | Delta::Build {worker_id, blueprint_id} => self.build(worker_id, blueprint_id), |
| 2219 | Delta::Disintegrate {unit_id} => self.disintegrate_unit(unit_id), |
| 2220 | Delta::Harvest {worker_id, direction} => self.harvest(worker_id, direction), |
| 2221 | Delta::Heal {healer_id, target_robot_id} => self.heal(healer_id, target_robot_id), |
| 2222 | Delta::Javelin {knight_id, target_unit_id} => self.javelin(knight_id, target_unit_id), |
| 2223 | Delta::LaunchRocket {rocket_id, location} => self.launch_rocket(rocket_id, location), |
| 2224 | Delta::Load {structure_id, robot_id} => self.load(structure_id, robot_id), |
| 2225 | Delta::Move {robot_id, direction} => self.move_robot(robot_id, direction), |
| 2226 | Delta::Overcharge {healer_id, target_robot_id} => self.overcharge(healer_id, target_robot_id), |
| 2227 | Delta::ProduceRobot {factory_id, robot_type} => self.produce_robot(factory_id, robot_type), |
| 2228 | Delta::QueueResearch {branch} => { self.queue_research(branch); Ok(()) }, |
| 2229 | Delta::Repair {worker_id, structure_id} => self.repair(worker_id, structure_id), |
| 2230 | Delta::Replicate {worker_id, direction} => self.replicate(worker_id, direction), |
| 2231 | Delta::ResetResearchQueue => { self.reset_research(); Ok(()) }, |
| 2232 | Delta::Unload {structure_id, direction} => self.unload(structure_id, direction), |
| 2233 | Delta::WriteTeamArray {index, value} => self.write_team_array(index, value), |
| 2234 | Delta::Nothing => Ok(()), |
| 2235 | } |
| 2236 | } |
| 2237 | |
| 2238 | /// Applies a turn message to this GameWorld, and ends the current turn. |
| 2239 | /// Returns the message to send to the next player. |
no test coverage detected