Compare commits

...

10 Commits

10 changed files with 88 additions and 116 deletions

View File

@ -27,6 +27,7 @@ sudo mkdir -p /var/lib/mnml/client
sudo mkdir -p /var/lib/mnml/data sudo mkdir -p /var/lib/mnml/data
sudo mkdir -p /var/lib/mnml/public/imgs sudo mkdir -p /var/lib/mnml/public/imgs
sudo mkdir -p /var/lib/mnml/data/instances/ sudo mkdir -p /var/lib/mnml/data/instances/
sudo mkdir -p /var/lib/mnml/data/games/
sudo chown -R $MNML_USER:$MNML_USER /var/lib/mnml sudo chown -R $MNML_USER:$MNML_USER /var/lib/mnml
# /var/log/mnml # /var/log/mnml

View File

@ -32,10 +32,11 @@
flex: 1; flex: 1;
display: grid; display: grid;
grid-template-columns: min-content 1fr; grid-template-columns: min-content 1fr;
grid-template-rows: min-content min-content 1fr min-content; grid-template-rows: min-content min-content min-content 1fr min-content;
grid-template-areas: grid-template-areas:
"name name " "name name "
"skills skills" "skills skills"
"colours colours"
"stats avatar" "stats avatar"
"defStats defStats"; "defStats defStats";
@ -88,6 +89,16 @@
} }
} }
.colours {
grid-area: colours;
display: flex;
flex-direction: row;
text-align: center;
justify-content: center;
div {
margin: 0.5em 0.75em;
} }
.offStats { .offStats {
grid-area: stats; grid-area: stats;
display: flex; display: flex;

View File

@ -169,43 +169,15 @@ function Construct(props) {
); );
}); });
const specs = range(0, 0).map(i => { const colours = () => {
const s = construct.specs[i];
if (!s) {
const equipping = specList.includes(vbox.stash[itemEquip]) && i === construct.specs.length;
const classes = `${equipping ? 'equipping' : 'gray'} empty`;
return ( return (
<button key={i} class={classes} disabled={!equipping} > <div class="colours" onMouseOver={e => hoverInfo(e, 'constructSpecs')} >
{shapes.None()} <div> {shapes.Red()} {construct.colours.red} </div>
</button> <div> {shapes.Blue()} {construct.colours.blue} </div>
<div> {shapes.Green()} {construct.colours.green} </div>
</div>
); );
} };
function specClick(e) {
if (!s) return false;
e.stopPropagation();
if (itemUnequip.length && itemUnequip[0] === construct.id && itemUnequip[1] === s
&& i === itemUnequip[2]) return setItemUnequip([]);
return setItemUnequip([construct.id, s, i]);
}
const highlight = itemUnequip[0] === construct.id && itemUnequip[1] === s && i === itemUnequip[2];
return (
<label onDragStart={ev => {
ev.dataTransfer.setData('text', '');
specClick(ev);
}} key={i} draggable="true" onDragEnd={() => setItemUnequip([])}>
<button
key={i}
class={`${highlight ? 'highlight' : ''}`}
onClick={specClick}
onMouseOver={e => hoverInfo(e, s)} >
{shapes[s]()}
</button>
</label>
);
});
const offensiveStats = Object.keys(OFFENSE).map(s => { const offensiveStats = Object.keys(OFFENSE).map(s => {
const stat = OFFENSE[s]; const stat = OFFENSE[s];
@ -243,9 +215,7 @@ function Construct(props) {
<div class="skills" onMouseOver={e => hoverInfo(e, 'constructSkills')} > <div class="skills" onMouseOver={e => hoverInfo(e, 'constructSkills')} >
{skills} {skills}
</div> </div>
<div class="specs" onMouseOver={e => hoverInfo(e, 'constructSpecs')} > {colours()}
{specs}
</div>
<div class="offStats"> <div class="offStats">
{offensiveStats} {offensiveStats}
</div> </div>

View File

@ -3,7 +3,7 @@ const { injectStripe } = require('react-stripe-elements');
function subPlan() { function subPlan() {
if (window.location.host === 'mnml.gg') return 'plan_Fjdtsd4i7aVLe1'; if (window.location.host === 'mnml.gg') return 'plan_Fjdtsd4i7aVLe1';
return 'prod_FWSA8RoyMMV3st'; return 'plan_Fhl9r7UdMadjGi';
} }
function bitsSku(d) { function bitsSku(d) {

View File

@ -36,7 +36,6 @@ function specThresholds(player, fullInfo, info) {
const dots = range(start, colourReq).map(j => { const dots = range(start, colourReq).map(j => {
const unmet = teamColours[c] < j + 1; const unmet = teamColours[c] < j + 1;
const reqClass = unmet const reqClass = unmet
? 'unmet' ? 'unmet'
: ''; : '';

View File

@ -102,7 +102,7 @@ function genItemInfo(item, itemInfo, player) {
? <div> Speed {shapes.SpeedStat()} multiplier {fullInfo.speed * 4}% </div> ? <div> Speed {shapes.SpeedStat()} multiplier {fullInfo.speed * 4}% </div>
: null; : null;
const thresholds = isSpec ? specThresholds(player, fullInfo, item) : null; // const thresholds = isSpec ? specThresholds(player, fullInfo, item) : null;
return ( return (
<div class="info info-item"> <div class="info info-item">
@ -112,7 +112,6 @@ function genItemInfo(item, itemInfo, player) {
{cooldown} {cooldown}
{itemDescription()} {itemDescription()}
{speed} {speed}
{thresholds}
</div> </div>
); );
} }

View File

@ -177,14 +177,15 @@ function registerEvents(store) {
} }
function setInstance(v) { function setInstance(v) {
const { account, ws, tutorial } = store.getState(); const { account, ws } = store.getState();
if (v) { if (v) {
setInvite(null); setInvite(null);
setPvp(false); setPvp(false);
clearTutorial();
const player = v.players.find(p => p.id === account.id); const player = v.players.find(p => p.id === account.id);
store.dispatch(actions.setPlayer(player)); store.dispatch(actions.setPlayer(player));
if (tutorial && v.rounds.length === 1 && v.time_control === 'Practice') tutorialVbox(player, store, tutorial); // if (tutorial && v.rounds.length === 1 && v.time_control === 'Practice') tutorialVbox(player, store, tutorial);
if (v.phase === 'Finished') { if (v.phase === 'Finished') {
ws.sendAccountInstances(); ws.sendAccountInstances();

View File

@ -30,10 +30,10 @@ impl Colours {
v.colours(&mut count); v.colours(&mut count);
} }
for cs in construct.skills.iter() { // for cs in construct.skills.iter() {
let v = Item::from(cs.skill); // let v = Item::from(cs.skill);
v.colours(&mut count); // v.colours(&mut count);
} // }
count count
} }
@ -309,9 +309,9 @@ impl Construct {
} }
pub fn spec_add(&mut self, spec: Spec) -> Result<&mut Construct, Error> { pub fn spec_add(&mut self, spec: Spec) -> Result<&mut Construct, Error> {
if self.specs.len() >= 3 { // if self.specs.len() >= 3 {
return Err(err_msg("maximum specs equipped")); // return Err(err_msg("maximum specs equipped"));
} // }
self.specs.push(spec); self.specs.push(spec);
return Ok(self.calculate_colours()); return Ok(self.calculate_colours());

View File

@ -604,71 +604,59 @@ impl Item {
// Lifes Upgrades // Lifes Upgrades
Item::LifeGG | Item::LifeGG |
Item::LifeGGPlus | Item::LifeGGPlus |
Item::LifeGGPlusPlus => format!("Increases construct GreenLife by {:?}. Item::LifeGGPlusPlus => format!("Increases construct GreenLife by {:?}.",
If your team meets total colour thresholds the spec provides additional bonuses.",
self.into_spec().unwrap().values().base()), self.into_spec().unwrap().values().base()),
Item::LifeRR | Item::LifeRR |
Item::LifeRRPlus | Item::LifeRRPlus |
Item::LifeRRPlusPlus => format!("Increases construct RedLife by {:?}. Item::LifeRRPlusPlus => format!("Increases construct RedLife by {:?}.",
If your team meets total colour thresholds the spec provides additional bonuses.",
self.into_spec().unwrap().values().base()), self.into_spec().unwrap().values().base()),
Item::LifeBB | Item::LifeBB |
Item::LifeBBPlus | Item::LifeBBPlus |
Item::LifeBBPlusPlus => format!("Increases construct BlueLife by {:?}. Item::LifeBBPlusPlus => format!("Increases construct BlueLife by {:?}.",
If your team meets total colour thresholds the spec provides additional bonuses.",
self.into_spec().unwrap().values().base()), self.into_spec().unwrap().values().base()),
Item::LifeRG | Item::LifeRG |
Item::LifeRGPlus | Item::LifeRGPlus |
Item::LifeRGPlusPlus => format!("Increases construct RedLife and GreenLife by {:?}. Item::LifeRGPlusPlus => format!("Increases construct RedLife and GreenLife by {:?}.",
If your team meets total colour thresholds the spec provides additional bonuses.",
self.into_spec().unwrap().values().base()), self.into_spec().unwrap().values().base()),
Item::LifeGB | Item::LifeGB |
Item::LifeGBPlus | Item::LifeGBPlus |
Item::LifeGBPlusPlus => format!("Increases construct GreenLife and BlueLife by {:?}. Item::LifeGBPlusPlus => format!("Increases construct GreenLife and BlueLife by {:?}.",
If your team meets total colour thresholds the spec provides additional bonuses.",
self.into_spec().unwrap().values().base()), self.into_spec().unwrap().values().base()),
Item::LifeRB | Item::LifeRB |
Item::LifeRBPlus | Item::LifeRBPlus |
Item::LifeRBPlusPlus => format!("Increases construct RedLife and BlueLife by {:?}. Item::LifeRBPlusPlus => format!("Increases construct RedLife and BlueLife by {:?}.",
If your team meets total colour thresholds the spec provides additional bonuses.",
self.into_spec().unwrap().values().base()), self.into_spec().unwrap().values().base()),
// Power Upgrades // Power Upgrades
Item::PowerRR | Item::PowerRR |
Item::PowerRRPlus | Item::PowerRRPlus |
Item::PowerRRPlusPlus => format!("Increases construct RedPower by {:?}%. Item::PowerRRPlusPlus => format!("Increases construct RedPower by {:?}%.",
If your team meets total colour thresholds the spec provides additional bonuses.",
self.into_spec().unwrap().values().base()), self.into_spec().unwrap().values().base()),
Item::PowerBB | Item::PowerBB |
Item::PowerBBPlus | Item::PowerBBPlus |
Item::PowerBBPlusPlus => format!("Increases construct BluePower by {:?}%. Item::PowerBBPlusPlus => format!("Increases construct BluePower by {:?}%.",
If your team meets total colour thresholds the spec provides additional bonuses.",
self.into_spec().unwrap().values().base()), self.into_spec().unwrap().values().base()),
Item::PowerGG | Item::PowerGG |
Item::PowerGGPlus | Item::PowerGGPlus |
Item::PowerGGPlusPlus => format!("Increases construct GreenPower by {:?}%. Item::PowerGGPlusPlus => format!("Increases construct GreenPower by {:?}%.",
If your team meets total colour thresholds the spec provides additional bonuses.",
self.into_spec().unwrap().values().base()), self.into_spec().unwrap().values().base()),
Item::PowerRG | Item::PowerRG |
Item::PowerRGPlus | Item::PowerRGPlus |
Item::PowerRGPlusPlus => format!("Increases construct GreenPower and RedPower by {:?}%. Item::PowerRGPlusPlus => format!("Increases construct GreenPower and RedPower by {:?}%.",
If your team meets total colour thresholds the spec provides additional bonuses.",
self.into_spec().unwrap().values().base()), self.into_spec().unwrap().values().base()),
Item::PowerGB | Item::PowerGB |
Item::PowerGBPlus | Item::PowerGBPlus |
Item::PowerGBPlusPlus => format!("Increases construct GreenPower and BluePower by {:?}%. Item::PowerGBPlusPlus => format!("Increases construct GreenPower and BluePower by {:?}%.",
If your team meets total colour thresholds the spec provides additional bonuses.",
self.into_spec().unwrap().values().base()), self.into_spec().unwrap().values().base()),
Item::PowerRB | Item::PowerRB |
Item::PowerRBPlus | Item::PowerRBPlus |
Item::PowerRBPlusPlus => format!("Increases construct RedPower and BluePower by {:?}%. Item::PowerRBPlusPlus => format!("Increases construct RedPower and BluePower by {:?}%.",
If your team meets total colour thresholds the spec provides additional bonuses.",
self.into_spec().unwrap().values().base()), self.into_spec().unwrap().values().base()),
// Speed Upgrades // Speed Upgrades
@ -689,8 +677,7 @@ impl Item {
Item::SpeedGGPlusPlus | Item::SpeedGGPlusPlus |
Item::SpeedRGPlusPlus | Item::SpeedRGPlusPlus |
Item::SpeedGBPlusPlus | Item::SpeedGBPlusPlus |
Item::SpeedRBPlusPlus => format!("Increases construct SpeedStat by {:?}%. Item::SpeedRBPlusPlus => format!("Increases construct SpeedStat by {:?}%.",
If your team meets total colour thresholds the spec provides additional bonuses.",
self.into_spec().unwrap().values().base()), self.into_spec().unwrap().values().base()),

View File

@ -336,6 +336,7 @@ impl Player {
println!("{:?}", colour_counts); println!("{:?}", colour_counts);
let total = (construct.colours.red + construct.colours.green + construct.colours.blue) as f64; let total = (construct.colours.red + construct.colours.green + construct.colours.blue) as f64;
if total != 0.0 {
let colour_pcts = colour_counts.iter_mut() let colour_pcts = colour_counts.iter_mut()
.map(|cc| (cc.0, cc.1 as f64 / total)) .map(|cc| (cc.0, cc.1 as f64 / total))
.collect::<Vec<_>>(); .collect::<Vec<_>>();
@ -353,7 +354,7 @@ impl Player {
construct.skills[0].skill construct.skills[0].skill
} else { } else {
let mut skill_item_combo = { let mut skill_item_combo = {
if colour_pcts[0].1 > 0.75 { if colour_pcts[0].1 > 0.70 {
vec![skill_item, colour_pcts[0].0, colour_pcts[0].0] vec![skill_item, colour_pcts[0].0, colour_pcts[0].0]
} else if colour_pcts[1].1 > 0.4 { } else if colour_pcts[1].1 > 0.4 {
vec![skill_item, colour_pcts[0].0, colour_pcts[1].0] vec![skill_item, colour_pcts[0].0, colour_pcts[1].0]
@ -378,6 +379,7 @@ impl Player {
// unlearn everything // unlearn everything
construct.skills = vec![]; construct.skills = vec![];
construct.learn_mut(colour_skill); construct.learn_mut(colour_skill);
}
// // now the item has been applied // // now the item has been applied
// // recalculate the stats of the whole player // // recalculate the stats of the whole player
@ -389,9 +391,11 @@ impl Player {
// } // }
// }); // });
// for construct in self.constructs.iter_mut() { let player_colours = Colours { red: 0, blue: 0, green: 0 };
// construct.apply_modifiers(&player_colours);
// } for construct in self.constructs.iter_mut() {
construct.apply_modifiers(&player_colours);
}
Ok(self) Ok(self)
} }