Merge branch 'master' of ssh://cryps.gg:40022/~/cryps
This commit is contained in:
commit
13c50726bc
@ -1,6 +1,6 @@
|
|||||||
const Phaser = require('phaser');
|
const Phaser = require('phaser');
|
||||||
|
|
||||||
const { TEXT, COLOURS, POSITIONS: { CRYP_LIST, MENU } } = require('./constants');
|
const { TEXT, COLOURS, POSITIONS: { CRYP_LIST, MENU, STATS } } = require('./constants');
|
||||||
|
|
||||||
const TEXT_MARGIN = 24;
|
const TEXT_MARGIN = 24;
|
||||||
|
|
||||||
@ -45,9 +45,20 @@ class CrypRows extends Phaser.GameObjects.Group {
|
|||||||
|
|
||||||
row.cryp = cryp;
|
row.cryp = cryp;
|
||||||
this.add(row);
|
this.add(row);
|
||||||
|
|
||||||
|
const crypStat = (stat, j) => {
|
||||||
|
const STAT_X = 0;
|
||||||
|
const STAT_Y = (j * TEXT_MARGIN) + ROW_Y + TEXT_MARGIN;
|
||||||
|
|
||||||
|
const text = list.add.text(STAT_X, STAT_Y, `${stat.stat}: ${stat.base}`, TEXT.NORMAL);
|
||||||
|
this.add(text);
|
||||||
|
};
|
||||||
|
|
||||||
|
const CRYP_STATS = [cryp.stamina, cryp.phys_dmg, cryp.spell_dmg];
|
||||||
|
CRYP_STATS.forEach(crypStat);
|
||||||
|
|
||||||
this.add(list.add.text(ROW_WIDTH - 20, ROW_Y, i + 1, TEXT.HEADER));
|
this.add(list.add.text(ROW_WIDTH - 20, ROW_Y, i + 1, TEXT.HEADER));
|
||||||
this.add(list.add.text(ROW_X, ROW_Y + (TEXT_MARGIN * 0), cryp.name, TEXT.HEADER));
|
this.add(list.add.text(ROW_X, ROW_Y + (TEXT_MARGIN * 0), cryp.name, TEXT.HEADER));
|
||||||
this.add(list.add.text(ROW_X, ROW_Y + (TEXT_MARGIN * 1), cryp.stamina.base, TEXT.NORMAL));
|
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -186,7 +186,7 @@ function createSocket(events) {
|
|||||||
|
|
||||||
if (!account) events.loginPrompt();
|
if (!account) events.loginPrompt();
|
||||||
if (process.env.NODE_ENV !== 'production') {
|
if (process.env.NODE_ENV !== 'production') {
|
||||||
// send({ method: 'account_login', params: { name: 'ntr', password: 'grepgrepgrep' } });
|
send({ method: 'account_login', params: { name: 'ntr', password: 'grepgrepgrep' } });
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -154,21 +154,31 @@ impl Cryp {
|
|||||||
|
|
||||||
pub fn create(mut self) -> Cryp {
|
pub fn create(mut self) -> Cryp {
|
||||||
let mut rng = thread_rng();
|
let mut rng = thread_rng();
|
||||||
let max = match self.lvl == 64 {
|
let stam_max = match self.lvl == 64 {
|
||||||
true => u64::max_value(),
|
true => u64::max_value(),
|
||||||
|
false => 2_u64.pow(self.lvl.into()),
|
||||||
|
};
|
||||||
|
|
||||||
|
let stam_min = match self.lvl == 1 {
|
||||||
|
true => 2_u64,
|
||||||
false => 2_u64.pow(self.lvl.saturating_sub(1).into()),
|
false => 2_u64.pow(self.lvl.saturating_sub(1).into()),
|
||||||
};
|
};
|
||||||
|
|
||||||
let min = match self.lvl == 1 {
|
let other_max = match self.lvl == 1 {
|
||||||
|
true => 2_u64,
|
||||||
|
false => 2_u64.pow(self.lvl.saturating_sub(1).into()),
|
||||||
|
};
|
||||||
|
|
||||||
|
let other_min = match self.lvl == 1 {
|
||||||
true => 2_u64,
|
true => 2_u64,
|
||||||
false => 2_u64.pow(self.lvl.saturating_sub(2).into()),
|
false => 2_u64.pow(self.lvl.saturating_sub(2).into()),
|
||||||
};
|
};
|
||||||
|
|
||||||
self.xp = max;
|
self.xp = stam_max;
|
||||||
|
|
||||||
self.phys_dmg.set(rng.gen_range(min, max));
|
self.phys_dmg.set(rng.gen_range(other_min, other_max));
|
||||||
self.spell_dmg.set(rng.gen_range(min, max));
|
self.spell_dmg.set(rng.gen_range(other_min, other_max));
|
||||||
self.stamina.set(rng.gen_range(min, max));
|
self.stamina.set(rng.gen_range(stam_min, stam_max));
|
||||||
self.hp.set(self.stamina.base);
|
self.hp.set(self.stamina.base);
|
||||||
|
|
||||||
self
|
self
|
||||||
|
|||||||
@ -407,6 +407,14 @@ impl Game {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn log_resolution(&mut self, source: &Cryp, target: &Cryp, cast: &Cast) -> &mut Game {
|
fn log_resolution(&mut self, source: &Cryp, target: &Cryp, cast: &Cast) -> &mut Game {
|
||||||
|
match cast.resolution.disable.disabled {
|
||||||
|
true => {
|
||||||
|
self.log.push(format!("{:?} {:?} {:?} disabled [{:?}]", source.name, cast.skill, target.name, cast.resolution.disable.effects));
|
||||||
|
return self;
|
||||||
|
},
|
||||||
|
false => (),
|
||||||
|
};
|
||||||
|
|
||||||
for result in cast.resolution.results.iter() {
|
for result in cast.resolution.results.iter() {
|
||||||
match result {
|
match result {
|
||||||
ResolutionResult::Damage { amount, category: _, immunity: _ } => {
|
ResolutionResult::Damage { amount, category: _, immunity: _ } => {
|
||||||
@ -690,14 +698,14 @@ fn generate_mob(lvl: u8) -> Cryp {
|
|||||||
let mut rng = thread_rng();
|
let mut rng = thread_rng();
|
||||||
|
|
||||||
// rng panics on min == max
|
// rng panics on min == max
|
||||||
let mob_lvl: u8 = match lvl {
|
// let mob_lvl: u8 = match lvl {
|
||||||
1 => 1,
|
// 1 => 1,
|
||||||
_ => rng.gen_range(lvl.saturating_sub(2), lvl)
|
// _ => rng.gen_range(lvl.saturating_sub(2), lvl)
|
||||||
};
|
// };
|
||||||
|
|
||||||
return Cryp::new()
|
return Cryp::new()
|
||||||
.named(&"bamboo basher".to_string())
|
.named(&"bamboo basher".to_string())
|
||||||
.level(mob_lvl)
|
.level(lvl)
|
||||||
.create();
|
.create();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user