hide mag struct internals
This commit is contained in:
		
							parent
							
								
									19dd5309cd
								
							
						
					
					
						commit
						f583b25176
					
				| @ -326,19 +326,34 @@ pub enum PhotonBlast { | |||||||
| #[derive(Debug, Clone, PartialEq)] | #[derive(Debug, Clone, PartialEq)] | ||||||
| pub struct Mag { | pub struct Mag { | ||||||
|     pub mag: MagType, |     pub mag: MagType, | ||||||
|     pub def: u16, |     def: u16, | ||||||
|     pub pow: u16, |     pow: u16, | ||||||
|     pub dex: u16, |     dex: u16, | ||||||
|     pub mnd: u16, |     mnd: u16, | ||||||
|     pub synchro: u8, |     pub synchro: u8, | ||||||
|     pub iq: u8, |     iq: u8, | ||||||
|     pub photon_blast: [Option<PhotonBlast>; 3], |     photon_blast: [Option<PhotonBlast>; 3], | ||||||
|     pub color: u8, |     pub color: u8, | ||||||
|     pub modifiers: Vec<MagModifier>, |     modifiers: Vec<MagModifier>, | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| impl Mag { | impl Mag { | ||||||
|  |     pub fn baby_mag(skin: u16) -> Mag { | ||||||
|  |         Mag { | ||||||
|  |             mag: MagType::Mag, | ||||||
|  |             def: 500, | ||||||
|  |             pow: 0, | ||||||
|  |             dex: 0, | ||||||
|  |             mnd: 0, | ||||||
|  |             synchro: 20, | ||||||
|  |             iq: 0, | ||||||
|  |             photon_blast: [None; 3], | ||||||
|  |             color: (skin % 18) as u8, | ||||||
|  |             modifiers: Vec::new(), | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     pub fn as_bytes(&self) -> [u8; 16] { |     pub fn as_bytes(&self) -> [u8; 16] { | ||||||
|         let mut result = [0; 16]; |         let mut result = [0; 16]; | ||||||
|         result[0..3].copy_from_slice(&self.mag.value()); |         result[0..3].copy_from_slice(&self.mag.value()); | ||||||
|  | |||||||
| @ -226,19 +226,7 @@ async fn new_character<EG: EntityGateway>(entity_gateway: &mut EG, user: &UserAc | |||||||
| 
 | 
 | ||||||
|     entity_gateway.create_item( |     entity_gateway.create_item( | ||||||
|         NewItemEntity { |         NewItemEntity { | ||||||
|             item: ItemDetail::Mag( |             item: ItemDetail::Mag(Mag::baby_mag(character.appearance.skin)), | ||||||
|                 Mag { |  | ||||||
|                     mag: MagType::Mag, |  | ||||||
|                     def: 500, |  | ||||||
|                     pow: 0, |  | ||||||
|                     dex: 0, |  | ||||||
|                     mnd: 0, |  | ||||||
|                     synchro: 20, |  | ||||||
|                     iq: 0, |  | ||||||
|                     photon_blast: [None; 3], |  | ||||||
|                     color: (character.appearance.skin % 18) as u8, |  | ||||||
|                     modifiers: Vec::new(), |  | ||||||
|                 }), |  | ||||||
|             location: ItemLocation::Inventory { |             location: ItemLocation::Inventory { | ||||||
|                 character_id: character.id, |                 character_id: character.id, | ||||||
|                 slot: 2, |                 slot: 2, | ||||||
|  | |||||||
| @ -136,18 +136,7 @@ impl RareDropTable { | |||||||
|                 }) |                 }) | ||||||
|             }, |             }, | ||||||
|             RareDropItem::Mag(mag) => { |             RareDropItem::Mag(mag) => { | ||||||
|                 ItemDropType::Mag(Mag { |                 ItemDropType::Mag(Mag::baby_mag(rng.gen_range(0, 18))) | ||||||
|                     mag: mag, |  | ||||||
|                     def: 500, |  | ||||||
|                     pow: 0, |  | ||||||
|                     dex: 0, |  | ||||||
|                     mnd: 0, |  | ||||||
|                     iq: 0, |  | ||||||
|                     synchro: 20, |  | ||||||
|                     photon_blast: [None; 3], |  | ||||||
|                     color: rng.gen_range(0, 18), |  | ||||||
|                     modifiers: Vec::new(), |  | ||||||
|                 }) |  | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user