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