tennis scoring -> str8 b05
This commit is contained in:
parent
948c62f9ef
commit
f04d179023
@ -9,6 +9,14 @@ function Scoreboard(args) {
|
|||||||
leave,
|
leave,
|
||||||
} = args;
|
} = 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 = () => {
|
let scoreText = () => {
|
||||||
if (player.score === 'Zero') return '▫▫▫▫';
|
if (player.score === 'Zero') return '▫▫▫▫';
|
||||||
if (player.score === 'One') return '■▫▫▫';
|
if (player.score === 'One') return '■▫▫▫';
|
||||||
@ -18,6 +26,7 @@ function Scoreboard(args) {
|
|||||||
if (player.score === 'Win') return '■■■■';
|
if (player.score === 'Win') return '■■■■';
|
||||||
return '';
|
return '';
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
if (!isPlayer) {
|
if (!isPlayer) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -15,9 +15,9 @@ use chrono::Duration;
|
|||||||
|
|
||||||
use account::Account;
|
use account::Account;
|
||||||
use account;
|
use account;
|
||||||
use events::{EventsTx, Event};
|
|
||||||
use player::{Player, Score, player_create};
|
use player::{Player, Score, player_create};
|
||||||
use construct::{Construct, construct_get};
|
|
||||||
use mob::{bot_player, instance_mobs};
|
use mob::{bot_player, instance_mobs};
|
||||||
use game::{Game, Phase, game_get, game_write, game_update};
|
use game::{Game, Phase, game_get, game_write, game_update};
|
||||||
use item::{Item};
|
use item::{Item};
|
||||||
|
|||||||
@ -655,9 +655,10 @@ impl Item {
|
|||||||
|
|
||||||
Item::Banish|
|
Item::Banish|
|
||||||
Item::BanishPlus |
|
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.",
|
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::Blast|
|
||||||
Item::BlastPlus |
|
Item::BlastPlus |
|
||||||
|
|||||||
@ -27,24 +27,26 @@ pub enum Score {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Score {
|
impl Score {
|
||||||
pub fn add_win(self, opp: &Score) -> Score {
|
pub fn add_win(self, _opp: &Score) -> Score {
|
||||||
match self {
|
match self {
|
||||||
Score::Zero => Score::One,
|
Score::Zero => Score::One,
|
||||||
Score::One => Score::Two,
|
Score::One => Score::Two,
|
||||||
Score::Two => Score::Three,
|
Score::Two => Score::Win,
|
||||||
Score::Three => match opp {
|
// Tennis scoring
|
||||||
Score::Adv => Score::Three,
|
// Score::Three => match opp {
|
||||||
Score::Three => Score::Adv,
|
// Score::Adv => Score::Three,
|
||||||
_ => Score::Win,
|
// Score::Three => Score::Adv,
|
||||||
}
|
// _ => Score::Win,
|
||||||
Score::Adv => Score::Win,
|
// }
|
||||||
|
// Score::Adv => Score::Win,
|
||||||
|
|
||||||
_ => panic!("faulty score increment {:?}", self),
|
_ => panic!("faulty score increment {:?}", self),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_loss(self) -> Score {
|
pub fn add_loss(self) -> Score {
|
||||||
match self {
|
match self {
|
||||||
Score::Adv => Score::Three,
|
// Score::Adv => Score::Three,
|
||||||
_ => self,
|
_ => 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);
|
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
|
player.score = player.score.add_loss(); // adv -> deuce
|
||||||
assert_eq!(player.score, Score::Three);
|
assert_eq!(player.score, Score::Three);
|
||||||
@ -391,7 +396,7 @@ mod tests {
|
|||||||
assert_eq!(player.score, Score::Adv);
|
assert_eq!(player.score, Score::Adv);
|
||||||
|
|
||||||
player.score = player.score.add_win(&Score::Three);
|
player.score = player.score.add_win(&Score::Three);
|
||||||
assert_eq!(player.score, Score::Win);
|
assert_eq!(player.score, Score::Win);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user