diff --git a/client/src/components/battle.jsx b/client/src/components/battle.jsx index 229294f5..c13d8418 100644 --- a/client/src/components/battle.jsx +++ b/client/src/components/battle.jsx @@ -1,9 +1,14 @@ const preact = require('preact'); function CrypPanel({ battle }) { + if (!battle) return
...
; return (
- {JSON.stringify(battle)} + {JSON.stringify(battle.a)} + {JSON.stringify(battle.b)} +
); } diff --git a/server/WORKLOG.md b/server/WORKLOG.md index 3cd8e97c..f74e3b48 100755 --- a/server/WORKLOG.md +++ b/server/WORKLOG.md @@ -50,4 +50,27 @@ gem td style attr combinations techno artists for the soundtrack slimey - ghostly \ No newline at end of file + ghostly + + + +* 1: Fighting against human nature is a losing battle +* 2: Aesthetics matter +* 3: Resonance is important +* 4: Make use of piggybacking +* 5: Don't confuse "interesting" with "fun" +* 6: Understand what emotion your game is trying to evoke +* 7: Allow the players the ability to make the game personal +* 8: The details are where the players fall in love with your game +* 9: Allow your players to have a sense of ownership +* 10: Leave room for the player to explore +* 11: If everyone likes your game, but no one loves it, it will fail +* 12: Don't design to prove you can do something +* 13: Make the fun part also the correct strategy to win +* 14: Don't be afraid to be blunt +* 15: Design the component for its intended audience +* 16: Be more afraid of boring your players than challenging them +* 17: You don't have to change much to change everything +* 18: Restrictions breed creativity +* 19: Your audience is good at recognizing problems and bad at solving them +* 20: All the lessons connect \ No newline at end of file diff --git a/server/src/battle.rs b/server/src/battle.rs index ef9779ae..0eb05dca 100755 --- a/server/src/battle.rs +++ b/server/src/battle.rs @@ -16,6 +16,7 @@ use cryp::Cryp; pub struct Battle { pub a: Cryp, pub b: Cryp, + pub log: Vec, } impl Battle { @@ -23,6 +24,7 @@ impl Battle { return Battle { a: a.clone(), b: b.clone(), + log: vec![], }; } @@ -35,12 +37,15 @@ impl Battle { panic!("{:?} is finished", self); } - let a_turn = self.a.turn(); - let b_turn = self.b.turn(); + let mut a_turn = self.a.turn(); + let mut b_turn = self.b.turn(); self.a.assign_dmg(&self.b, &a_turn, &b_turn); self.b.assign_dmg(&self.a, &b_turn, &a_turn); + self.log.append(&mut a_turn.log); + self.log.append(&mut b_turn.log); + self } diff --git a/server/src/cryp.rs b/server/src/cryp.rs index ee447483..625b3842 100755 --- a/server/src/cryp.rs +++ b/server/src/cryp.rs @@ -38,25 +38,25 @@ impl Stat { self } - fn roll(&self, c: &Cryp) -> Roll { + fn roll(&self, c: &Cryp, log: &mut Vec) -> Roll { let mut rng = thread_rng(); let base: u64 = rng.gen(); let mut roll = Roll { kind: self.kind, base, result: base }; - println!("{:?}", self.kind); - println!("{:064b} <- base roll", base); + log.push(format!("{:?}", self.kind)); + log.push(format!("{:064b} <- base roll", base)); // apply skills roll = c.skills.iter().fold(roll, |roll, s| s.apply(roll)); // finally combine with stat - println!("{:064b} <- finalised", roll.result); + log.push(format!("{:064b} <- finalised", roll.result)); roll.result = roll.result & self.value; - println!("{:064b} & <- attribute roll", self.value); - println!("{:064b} = {:?}", roll.result, roll.result); - println!(""); + log.push(format!("{:064b} & <- attribute roll", self.value)); + log.push(format!("{:064b} = {:?}", roll.result, roll.result)); + log.push(format!("")); return roll; } @@ -70,6 +70,7 @@ impl Stat { pub struct Turn { pub dmg: Roll, pub def: Roll, + pub log: Vec, } #[derive(Debug,Clone,Serialize,Deserialize)] @@ -143,11 +144,12 @@ impl Cryp { } pub fn turn(&self) -> Turn { - // println!("{:?}'s turn:", c.name); - let dmg = self.dmg.roll(self); - let def = self.def.roll(self); + let mut log = vec![format!("{:?}'s turn:", self.name)]; - return Turn { dmg, def } + let dmg = self.dmg.roll(self, &mut log); + let def = self.def.roll(self, &mut log); + + return Turn { dmg, def, log } } pub fn create(mut self) -> Cryp {