change combat format

This commit is contained in:
ntr 2018-10-17 16:57:57 +11:00
parent 7d70a864fd
commit 6b2eda8391
5 changed files with 67 additions and 33 deletions

View File

@ -6,9 +6,14 @@ function CrypPanel({ battle }) {
<div className="">
<div>{JSON.stringify(battle.a)}</div>
<div>{JSON.stringify(battle.b)}</div>
<ul>
{battle.log.map((l, i) => (<li key={i} >{l}</li>))}
</ul>
<div>
{
battle.log.map((l, i) => {
if (l === '') return (<br/>);
return <p key={i} >{l}</p>
})
}
</div>
</div>
);
}

View File

@ -15,6 +15,22 @@ const stringSort = (k, desc) => {
};
};
const numSort = (k, desc) => {
if (desc) {
return (a, b) => {
if (!get(a, k)) return 1;
if (!get(b, k)) return -1;
return get(b, k) - get(a, k);
};
}
return (a, b) => {
if (!get(a, k)) return 1;
if (!get(b, k)) return -1;
return get(a, k) - get(b, k);
};
};
module.exports = {
stringSort,
numSort,
}

View File

@ -1,34 +1,39 @@
* Battling
* QOL
* auto login
* ws reconnect ✔️
* Levelling
* ws reconnect ✔
* Levelling ✔
* Global rolls
* Logins ✔️
* Cryp Ownership ✔
* Matchmaking
* Lobbies
* Create
* Join
* Resolve
* Stats
* Scrabble grid
* skills
* offensive -> choose target
* defensive
* Items
* rez ✔
* unselect item with esc + button
* Grid reroll
* Colour scheme
* Missions
* Bosses
* Cryp Generation
*
* Blockchain Integration?
# Principles
* Experience something
* Express something

View File

@ -170,8 +170,15 @@ impl Cryp {
}
pub fn assign_dmg(&mut self, opp: &Cryp, plr_t: &mut Turn, opp_t: &Turn) -> &mut Cryp {
let final_dmg = opp_t.dmg.result.saturating_sub(plr_t.def.result);
let blocked = opp_t.dmg.result.saturating_sub(final_dmg);
// let final_dmg = opp_t.dmg.result.saturating_sub(plr_t.def.result);
// let blocked = opp_t.dmg.result.saturating_sub(final_dmg);
let final_dmg = opp_t.dmg.result & !plr_t.def.result;
let blocked = opp_t.dmg.result & plr_t.def.result;
plr_t.log.push(format!("{:064b} <- attacking roll {:?}", opp_t.dmg.result, opp_t.dmg.result));
// plr_t.log.push(format!("{:064b} <- blocking roll {:?}", plr_t.def.result, plr_t.def.result));
plr_t.log.push(format!("{:064b} <- final dmg {:?} ({:?} blocked)", final_dmg, final_dmg, blocked));
self.hp.reduce(final_dmg);
@ -182,6 +189,7 @@ impl Cryp {
,blocked
,self.hp.value));
plr_t.log.push(format!(""));
self
}

View File

@ -20,7 +20,7 @@ fn stoney(s: &Skill, mut roll: Roll) -> Roll {
let effect = 0b11110000;
match roll.kind {
StatKind::Def => {
println!("{:064b} | <- {:?}", effect, s);
// println!("{:064b} | <- {:?}", effect, s);
roll.result = roll.result | effect;
roll
},