fix damage bug
This commit is contained in:
parent
495b7333c5
commit
6a1f9de3e2
@ -33,7 +33,6 @@ function GamePanel(props) {
|
||||
});
|
||||
|
||||
function PlayerCrypCard(cryp) {
|
||||
if (activeIncoming) console.log('should be a pointer');
|
||||
return (
|
||||
<div
|
||||
key={cryp.id}
|
||||
|
||||
@ -64,6 +64,8 @@ skill order defined by cryp/skill speed
|
||||
|
||||
counter -> dmg <-> heal
|
||||
|
||||
immune to status effects
|
||||
|
||||
|
||||
physical, magic, pure dmg?
|
||||
elemental?
|
||||
|
||||
@ -62,6 +62,7 @@ impl GameSkill {
|
||||
// roll = c.skills.iter().fold(roll, |roll, s| s.apply(roll));
|
||||
|
||||
// finally combine with stat
|
||||
println!("{:?}'s stats", c.name);
|
||||
println!("{:064b} <- finalised", roll.result);
|
||||
roll.result = roll.result & stat.value;
|
||||
|
||||
@ -385,8 +386,9 @@ impl Game {
|
||||
for team in self.teams.clone().iter_mut() {
|
||||
for incoming in team.incoming.clone().iter_mut() {
|
||||
// they better fuckin be there
|
||||
let mut cryp = self.cryp_by_id(incoming.target_cryp_id.unwrap()).clone();
|
||||
let mut cryp = self.cryp_by_id(incoming.cryp_id).clone();
|
||||
let mut target_cryp = self.cryp_by_id(incoming.target_cryp_id.unwrap()).clone();
|
||||
println!("{:?} is attacking {:?}", cryp.name, target_cryp.name);
|
||||
incoming.resolve(&mut cryp, &mut target_cryp);
|
||||
self.update_cryp(target_cryp);
|
||||
}
|
||||
|
||||
@ -184,19 +184,25 @@ impl Rpc {
|
||||
}
|
||||
|
||||
|
||||
fn cryp_spawn(data: Vec<u8>, tx: &mut Transaction, account: Option<Account>, _client: &mut WebSocket<TcpStream>) -> Result<RpcResponse, Error> {
|
||||
match from_slice::<CrypSpawnMsg>(&data) {
|
||||
Ok(v) => {
|
||||
match account {
|
||||
Some(a) => Ok(RpcResponse {
|
||||
method: v.method,
|
||||
params: RpcResult::SpawnCryp(cryp_spawn(v.params, tx, &a)?)
|
||||
}),
|
||||
None => Err(err_msg("auth required")),
|
||||
}
|
||||
}
|
||||
Err(_e) => Err(err_msg("invalid params")),
|
||||
}
|
||||
fn cryp_spawn(data: Vec<u8>, tx: &mut Transaction, account: Option<Account>, client: &mut WebSocket<TcpStream>) -> Result<RpcResponse, Error> {
|
||||
let a = match account {
|
||||
Some(a) => a,
|
||||
None => return Err(err_msg("auth required")),
|
||||
};
|
||||
|
||||
let msg = from_slice::<CrypSpawnMsg>(&data).or(Err(err_msg("invalid params")))?;
|
||||
|
||||
Rpc::send_msg(client, RpcResponse {
|
||||
method: "cryp_spawn".to_string(),
|
||||
params: RpcResult::CrypSpawn(cryp_spawn(msg.params, tx, &a)?)
|
||||
})?;
|
||||
|
||||
let cryp_list = RpcResponse {
|
||||
method: "account_cryps".to_string(),
|
||||
params: RpcResult::CrypList(account_cryps(tx, &a)?)
|
||||
};
|
||||
|
||||
Ok(cryp_list)
|
||||
}
|
||||
|
||||
fn account_create(data: Vec<u8>, tx: &mut Transaction, _account: Option<Account>, _client: &mut WebSocket<TcpStream>) -> Result<RpcResponse, Error> {
|
||||
@ -268,7 +274,7 @@ pub struct RpcResponse {
|
||||
|
||||
#[derive(Debug,Clone,Serialize,Deserialize)]
|
||||
pub enum RpcResult {
|
||||
SpawnCryp(Cryp),
|
||||
CrypSpawn(Cryp),
|
||||
Account(Account),
|
||||
CrypList(Vec<Cryp>),
|
||||
GameState(Game),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user