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/public/imgs
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
# /var/log/mnml

View File

@ -32,10 +32,11 @@
flex: 1;
display: grid;
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:
"name name "
"skills skills"
"colours colours"
"stats avatar"
"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 {
grid-area: stats;
display: flex;

View File

@ -169,43 +169,15 @@ function Construct(props) {
);
});
const specs = range(0, 0).map(i => {
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 (
<button key={i} class={classes} disabled={!equipping} >
{shapes.None()}
</button>
);
}
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];
const colours = () => {
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>
<div class="colours" onMouseOver={e => hoverInfo(e, 'constructSpecs')} >
<div> {shapes.Red()} {construct.colours.red} </div>
<div> {shapes.Blue()} {construct.colours.blue} </div>
<div> {shapes.Green()} {construct.colours.green} </div>
</div>
);
});
};
const offensiveStats = Object.keys(OFFENSE).map(s => {
const stat = OFFENSE[s];
@ -243,9 +215,7 @@ function Construct(props) {
<div class="skills" onMouseOver={e => hoverInfo(e, 'constructSkills')} >
{skills}
</div>
<div class="specs" onMouseOver={e => hoverInfo(e, 'constructSpecs')} >
{specs}
</div>
{colours()}
<div class="offStats">
{offensiveStats}
</div>

View File

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

View File

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

View File

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

View File

@ -177,14 +177,15 @@ function registerEvents(store) {
}
function setInstance(v) {
const { account, ws, tutorial } = store.getState();
const { account, ws } = store.getState();
if (v) {
setInvite(null);
setPvp(false);
clearTutorial();
const player = v.players.find(p => p.id === account.id);
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') {
ws.sendAccountInstances();

View File

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

View File

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

View File

@ -336,48 +336,50 @@ impl Player {
println!("{:?}", colour_counts);
let total = (construct.colours.red + construct.colours.green + construct.colours.blue) as f64;
let colour_pcts = colour_counts.iter_mut()
.map(|cc| (cc.0, cc.1 as f64 / total))
.collect::<Vec<_>>();
if total != 0.0 {
let colour_pcts = colour_counts.iter_mut()
.map(|cc| (cc.0, cc.1 as f64 / total))
.collect::<Vec<_>>();
println!("{:?}", colour_pcts);
println!("{:?}", colour_pcts);
let skill_item = match item.into_skill().is_some() {
true => item,
false => construct.skills[0].skill.base(),
};
let skill_item = match item.into_skill().is_some() {
true => item,
false => construct.skills[0].skill.base(),
};
let colour_skill = {
// no colours
if colour_pcts[0].1.is_infinite() {
construct.skills[0].skill
} else {
let mut skill_item_combo = {
if colour_pcts[0].1 > 0.75 {
vec![skill_item, colour_pcts[0].0, colour_pcts[0].0]
} else if colour_pcts[1].1 > 0.4 {
vec![skill_item, colour_pcts[0].0, colour_pcts[1].0]
} else {
// special triple skill_item
vec![skill_item, colour_pcts[0].0, colour_pcts[1].0]
}
};
let colour_skill = {
// no colours
if colour_pcts[0].1.is_infinite() {
construct.skills[0].skill
} else {
let mut skill_item_combo = {
if colour_pcts[0].1 > 0.70 {
vec![skill_item, colour_pcts[0].0, colour_pcts[0].0]
} else if colour_pcts[1].1 > 0.4 {
vec![skill_item, colour_pcts[0].0, colour_pcts[1].0]
} else {
// special triple skill_item
vec![skill_item, colour_pcts[0].0, colour_pcts[1].0]
}
};
skill_item_combo.sort_unstable();
skill_item_combo.sort_unstable();
println!("{:?}", skill_item_combo);
let combos = get_combos();
let combo = combos.iter().find(|c| c.components == skill_item_combo)
.ok_or(err_msg("no combo for colour skill"))?;
println!("{:?}", skill_item_combo);
let combos = get_combos();
let combo = combos.iter().find(|c| c.components == skill_item_combo)
.ok_or(err_msg("no combo for colour skill"))?;
combo.item.into_skill()
.ok_or(format_err!("item {:?} has no associated skill", combo.item))?
}
};
combo.item.into_skill()
.ok_or(format_err!("item {:?} has no associated skill", combo.item))?
}
};
// unlearn everything
construct.skills = vec![];
construct.learn_mut(colour_skill);
// unlearn everything
construct.skills = vec![];
construct.learn_mut(colour_skill);
}
// // now the item has been applied
// // recalculate the stats of the whole player
@ -389,9 +391,11 @@ impl Player {
// }
// });
// for construct in self.constructs.iter_mut() {
// construct.apply_modifiers(&player_colours);
// }
let player_colours = Colours { red: 0, blue: 0, green: 0 };
for construct in self.constructs.iter_mut() {
construct.apply_modifiers(&player_colours);
}
Ok(self)
}