tennis scoring -> str8 b05

This commit is contained in:
Mashy 2019-09-19 15:07:16 +10:00
parent 948c62f9ef
commit f04d179023
5 changed files with 32 additions and 17 deletions

View File

@ -9,6 +9,14 @@ function Scoreboard(args) {
leave,
} = args;
const scoreText = () => {
if (player.score === 'Zero') return '▫▫▫';
if (player.score === 'One') return '■▫▫';
if (player.score === 'Two') return '■■▫';
if (player.score === 'Win') return '■■■';
return '';
};
/*
let scoreText = () => {
if (player.score === 'Zero') return '▫▫▫▫';
if (player.score === 'One') return '■▫▫▫';
@ -18,6 +26,7 @@ function Scoreboard(args) {
if (player.score === 'Win') return '■■■■';
return '';
};
*/
if (!isPlayer) {
return (

View File

@ -56,8 +56,8 @@ function Welcome() {
<p> Turn-based 1v1 strategy game in an abstract setting. </p>
<p>
Build a unique team of 3 constructs from a range of skills and specialisations.<br />
Outplay your opponent in multiple rounds by adapting to an always shifting meta. <br />
Simple rules, complex interactions and unique mechanics.<br />
Outplay your opponent in multiple rounds by adapting to an always shifting meta. <br />
Simple rules, complex interactions and unique mechanics.<br />
</p>
<p>
Free to play, no pay to win. Register to start playing.<br />

View File

@ -15,9 +15,9 @@ use chrono::Duration;
use account::Account;
use account;
use events::{EventsTx, Event};
use player::{Player, Score, player_create};
use construct::{Construct, construct_get};
use mob::{bot_player, instance_mobs};
use game::{Game, Phase, game_get, game_write, game_update};
use item::{Item};

View File

@ -655,9 +655,10 @@ impl Item {
Item::Banish|
Item::BanishPlus |
Item::BanishPlusPlus => format!("Banish target for {:?}T.
Item::BanishPlusPlus => format!("Banish target for {:?}T. Deal blue damage and red damage equal to {:?}% target red and blue life.
Banished constructs are immune to all skills and effects.",
self.into_skill().unwrap().effect()[0].get_duration()),
self.into_skill().unwrap().effect()[0].get_duration(),
self.into_skill().unwrap().multiplier()),
Item::Blast|
Item::BlastPlus |

View File

@ -27,24 +27,26 @@ pub enum Score {
}
impl Score {
pub fn add_win(self, opp: &Score) -> Score {
pub fn add_win(self, _opp: &Score) -> Score {
match self {
Score::Zero => Score::One,
Score::One => Score::Two,
Score::Two => Score::Three,
Score::Three => match opp {
Score::Adv => Score::Three,
Score::Three => Score::Adv,
_ => Score::Win,
}
Score::Adv => Score::Win,
Score::Two => Score::Win,
// Tennis scoring
// Score::Three => match opp {
// Score::Adv => Score::Three,
// Score::Three => Score::Adv,
// _ => Score::Win,
// }
// Score::Adv => Score::Win,
_ => panic!("faulty score increment {:?}", self),
}
}
pub fn add_loss(self) -> Score {
match self {
Score::Adv => Score::Three,
// Score::Adv => Score::Three,
_ => self,
}
}
@ -376,7 +378,10 @@ mod tests {
player.score = player.score.add_win(&Score::Zero);
player.score = player.score.add_win(&Score::Zero);
player.score = player.score.add_win(&Score::Zero);
assert_eq!(player.score, Score::Three); // 40 / 0
assert_eq!(player.score, Score::Win); // 40 / 0
// Bo7 tennis scoring
/*assert_eq!(player.score, Score::Three); // 40 / 0
player.score = player.score.add_loss(); // adv -> deuce
assert_eq!(player.score, Score::Three);
@ -391,7 +396,7 @@ mod tests {
assert_eq!(player.score, Score::Adv);
player.score = player.score.add_win(&Score::Three);
assert_eq!(player.score, Score::Win);
assert_eq!(player.score, Score::Win);*/
}
}