Merge branch 'master' of ssh://cryps.gg:40022/~/cryps
This commit is contained in:
commit
50104e8421
@ -28,7 +28,7 @@ class StatBar extends Phaser.GameObjects.Graphics {
|
|||||||
|
|
||||||
if (type === 'HP') {
|
if (type === 'HP') {
|
||||||
this.val = this.crypObj.cryp.hp.value;
|
this.val = this.crypObj.cryp.hp.value;
|
||||||
this.max = this.crypObj.cryp.stamina.value;
|
this.max = this.crypObj.cryp.hp.value;
|
||||||
this.margin = 0;
|
this.margin = 0;
|
||||||
} else if (type === 'Red Shield') {
|
} else if (type === 'Red Shield') {
|
||||||
this.val = this.crypObj.cryp.red_shield.value;
|
this.val = this.crypObj.cryp.red_shield.value;
|
||||||
|
|||||||
@ -63,11 +63,11 @@ class StatSheet extends Phaser.Scene {
|
|||||||
const crypStat = (stat, i) => {
|
const crypStat = (stat, i) => {
|
||||||
const STAT_X = X;
|
const STAT_X = X;
|
||||||
const STAT_Y = Y + (i + 2) * TEXT_MARGIN;
|
const STAT_Y = Y + (i + 2) * TEXT_MARGIN;
|
||||||
this.add.text(STAT_X, STAT_Y, `${stat.stat}: ${stat.value}`, TEXT.NORMAL);
|
this.add.text(STAT_X, STAT_Y, `${stat.stat}: ${stat.base} -> ${stat.value}`, TEXT.NORMAL);
|
||||||
};
|
};
|
||||||
|
|
||||||
const CRYP_STATS = [
|
const CRYP_STATS = [
|
||||||
cryp.stamina,
|
cryp.hp,
|
||||||
cryp.red_shield,
|
cryp.red_shield,
|
||||||
cryp.blue_shield,
|
cryp.blue_shield,
|
||||||
cryp.evasion,
|
cryp.evasion,
|
||||||
|
|||||||
@ -19,7 +19,7 @@ This homepage shows your cryps, joinable online games, PVE options and your item
|
|||||||
If you have no cryps yet, press SPAWN and give your cryp a name to create one.
|
If you have no cryps yet, press SPAWN and give your cryp a name to create one.
|
||||||
Once you have made a cryp, click on them to visit their stat page and teach them some SKILLS.
|
Once you have made a cryp, click on them to visit their stat page and teach them some SKILLS.
|
||||||
The stat page also has descriptions of each skill and their effects.
|
The stat page also has descriptions of each skill and their effects.
|
||||||
cryps have 3 basic stats: stamina, red damage and magic damage.
|
cryps have 3 basic stats: hp, red damage and magic damage.
|
||||||
Toggle whether a cryp is selected for your team by clicking the coloured stripes next to the cryp or press 1,2,3.
|
Toggle whether a cryp is selected for your team by clicking the coloured stripes next to the cryp or press 1,2,3.
|
||||||
Once you have a team ready press the New PVE Game button to start playing.
|
Once you have a team ready press the New PVE Game button to start playing.
|
||||||
`;
|
`;
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
### Defenses ###
|
### Defenses ###
|
||||||
|
|
||||||
Rare `Increased Stamina`
|
Rare `Increased Hp`
|
||||||
|
|
||||||
Common `Increased Evasion rating`
|
Common `Increased Evasion rating`
|
||||||
Common `Increased Blue Shield rating`
|
Common `Increased Blue Shield rating`
|
||||||
|
|||||||
@ -76,7 +76,7 @@ Non-Violence
|
|||||||
Enhancement & Preservation
|
Enhancement & Preservation
|
||||||
--------------------------
|
--------------------------
|
||||||
|
|
||||||
the philosophy of nonviolence teaches that the sanctity of life is above all else
|
the philosophy of nonviolence teaches that the sanctity of hp is above all else
|
||||||
its adherants are defensive and gracious, seeking to minimise the damage done by others and doing no direct harm themselves.
|
its adherants are defensive and gracious, seeking to minimise the damage done by others and doing no direct harm themselves.
|
||||||
they seek to prevent damage in any way possible
|
they seek to prevent damage in any way possible
|
||||||
|
|
||||||
@ -98,8 +98,8 @@ specialise in magical damage dealing
|
|||||||
|
|
||||||
* damage amplification
|
* damage amplification
|
||||||
* nukes
|
* nukes
|
||||||
* life leach
|
* hp leach
|
||||||
* life exchange
|
* hp exchange
|
||||||
* poison
|
* poison
|
||||||
* aoe
|
* aoe
|
||||||
|
|
||||||
|
|||||||
@ -85,17 +85,10 @@ In your team Cryp #1 has `Strike`, Cryp #2 has `Slay` and `Heal`, Cryp #3 has `S
|
|||||||
|
|
||||||
### Generic Specs
|
### Generic Specs
|
||||||
|
|
||||||
(Base white skills not upgraded count as have 1 gem basic ?)
|
# Basic % Hp
|
||||||
|
`Base` -> 5% inc hp
|
||||||
# Basic Damage
|
|
||||||
`Base` -> 10% inc basic damage
|
|
||||||
`Team Bonus` -> 3 basic gems -> +10% // 6 basic gems -> +15% // 12 basic gems -> +25%
|
|
||||||
Maximum 60% inc basic damage
|
|
||||||
|
|
||||||
# Basic % Life
|
|
||||||
`Base` -> 5% inc life
|
|
||||||
`Team Bonus` -> 3 basic gems -> +5% // 6 basic gems -> +10% // 12 basic gems -> +15%
|
`Team Bonus` -> 3 basic gems -> +5% // 6 basic gems -> +10% // 12 basic gems -> +15%
|
||||||
Maximum 35% inc life
|
Maximum 35% inc hp
|
||||||
|
|
||||||
# Basic Speed
|
# Basic Speed
|
||||||
`Base` -> 5% inc speed
|
`Base` -> 5% inc speed
|
||||||
@ -146,9 +139,9 @@ Add 1 blue and 1 green gem
|
|||||||
`Team Bonus` (2B + 2G gems) -> +5% + 5% // (5B + 5G gems) -> +10% + 10% % // (10B + 10G) gems -> +15% + 15%
|
`Team Bonus` (2B + 2G gems) -> +5% + 5% // (5B + 5G gems) -> +10% + 10% % // (10B + 10G) gems -> +15% + 15%
|
||||||
Maximum +35% inc blue damage and 35% inc healing
|
Maximum +35% inc blue damage and 35% inc healing
|
||||||
|
|
||||||
### Increased Life Combos ###
|
### Increased Hp Combos ###
|
||||||
|
|
||||||
Generate by combining `Generic Spec (Basic Life)` with respective RGB
|
Generate by combining `Generic Spec (Basic Hp)` with respective RGB
|
||||||
|
|
||||||
# Increased % Red Shield (Basic %HP + 2R)
|
# Increased % Red Shield (Basic %HP + 2R)
|
||||||
Add 2 `red gems`
|
Add 2 `red gems`
|
||||||
@ -156,11 +149,11 @@ Add 2 `red gems`
|
|||||||
`Team Bonus` 5 red gems -> +10% // 10 red gems -> +15% // 20 red gems -> +20%
|
`Team Bonus` 5 red gems -> +10% // 10 red gems -> +15% // 20 red gems -> +20%
|
||||||
Maximum +55% inc red shield
|
Maximum +55% inc red shield
|
||||||
|
|
||||||
# Increased % Red Shield and Life (Basic %HP + 1R1G)
|
# Increased % Red Shield and Hp (Basic %HP + 1R1G)
|
||||||
Add 1 red 1 green gem
|
Add 1 red 1 green gem
|
||||||
`Base` -> 5% inc red shield and 5% inc life
|
`Base` -> 5% inc red shield and 5% inc hp
|
||||||
`Team Bonus` (2R + 2G gems) -> +5% + 5% // (5R + 5G gems) -> +10% + 10% % // (10R + 10G) gems -> +15% + 15%
|
`Team Bonus` (2R + 2G gems) -> +5% + 5% // (5R + 5G gems) -> +10% + 10% % // (10R + 10G) gems -> +15% + 15%
|
||||||
Maximum +35% inc red shield and 35% inc life
|
Maximum +35% inc red shield and 35% inc hp
|
||||||
|
|
||||||
# Increased % Blue Shield (Basic %HP + 2B)
|
# Increased % Blue Shield (Basic %HP + 2B)
|
||||||
Add 2 `blue gems`
|
Add 2 `blue gems`
|
||||||
@ -168,13 +161,13 @@ Add 2 `blue gems`
|
|||||||
`Team Bonus` 5 blue gems -> +10% // 10 blue gems -> +15% // 20 blue gems -> +20%
|
`Team Bonus` 5 blue gems -> +10% // 10 blue gems -> +15% // 20 blue gems -> +20%
|
||||||
Maximum +55% inc blue shield
|
Maximum +55% inc blue shield
|
||||||
|
|
||||||
# Increased % Blue Shield and Life (Basic %HP + 1B1G)
|
# Increased % Blue Shield and Hp (Basic %HP + 1B1G)
|
||||||
Add `1 blue and 1 green gems`
|
Add `1 blue and 1 green gems`
|
||||||
`Base` -> 5% inc red shield and 5% inc life
|
`Base` -> 5% inc red shield and 5% inc hp
|
||||||
`Team Bonus` (2B + 2G gems) -> +5% + 5% // (5B + 5G gems) -> +10% + 10% % // (10B + 10G) gems -> +15% + 15%
|
`Team Bonus` (2B + 2G gems) -> +5% + 5% // (5B + 5G gems) -> +10% + 10% % // (10B + 10G) gems -> +15% + 15%
|
||||||
Maximum +35% inc blue shield and 35% inc life
|
Maximum +35% inc blue shield and 35% inc hp
|
||||||
|
|
||||||
# Increased % Life (Basic %HP + 2G)
|
# Increased % Hp (Basic %HP + 2G)
|
||||||
Add `2 green gems`
|
Add `2 green gems`
|
||||||
`Base` -> 10% inc hp
|
`Base` -> 10% inc hp
|
||||||
`Team Bonus` 5 green gems -> +10% // 10 green gems -> +15% // 20 green gems -> +20%
|
`Team Bonus` 5 green gems -> +10% // 10 green gems -> +15% // 20 green gems -> +20%
|
||||||
@ -182,7 +175,7 @@ Maximum +55% inc hp
|
|||||||
|
|
||||||
# Increased % Blue and Red Shield (Basic %HP + 1B1R)
|
# Increased % Blue and Red Shield (Basic %HP + 1B1R)
|
||||||
Add `1 blue and 1 red gem`
|
Add `1 blue and 1 red gem`
|
||||||
`Base` -> 5% inc red shield and 5% inc life
|
`Base` -> 5% inc red shield and 5% inc hp
|
||||||
`Team Bonus` (2B + 2R gems) -> +5% + 5% // (5B + 5R gems) -> +10% + 10% % // (10B + 10R) gems -> +15% + 15%
|
`Team Bonus` (2B + 2R gems) -> +5% + 5% // (5B + 5R gems) -> +10% + 10% % // (10B + 10R) gems -> +15% + 15%
|
||||||
Maximum +35% inc blue shield and 35% inc red shield
|
Maximum +35% inc blue shield and 35% inc red shield
|
||||||
|
|
||||||
|
|||||||
@ -44,7 +44,6 @@ pub enum Stat {
|
|||||||
Int,
|
Int,
|
||||||
Hp,
|
Hp,
|
||||||
Speed,
|
Speed,
|
||||||
Stamina,
|
|
||||||
RedDamage,
|
RedDamage,
|
||||||
RedDamageTaken,
|
RedDamageTaken,
|
||||||
BlueDamage,
|
BlueDamage,
|
||||||
@ -60,6 +59,7 @@ pub enum Stat {
|
|||||||
pub struct CrypStat {
|
pub struct CrypStat {
|
||||||
base: u64,
|
base: u64,
|
||||||
value: u64,
|
value: u64,
|
||||||
|
max: u64,
|
||||||
pub stat: Stat,
|
pub stat: Stat,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ impl CrypStat {
|
|||||||
pub fn recalculate(&mut self, specs: &Vec<Spec>) -> &mut CrypStat {
|
pub fn recalculate(&mut self, specs: &Vec<Spec>) -> &mut CrypStat {
|
||||||
let specs = specs
|
let specs = specs
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|s| s.affects() == self.stat)
|
.filter(|s| s.affects().contains(&self.stat))
|
||||||
.map(|s| *s)
|
.map(|s| *s)
|
||||||
.collect::<Vec<Spec>>();
|
.collect::<Vec<Spec>>();
|
||||||
|
|
||||||
@ -80,6 +80,7 @@ impl CrypStat {
|
|||||||
// but still needs access to the base amount
|
// but still needs access to the base amount
|
||||||
let value = specs.iter().fold(self.base, |acc, s| s.apply(acc, self.base));
|
let value = specs.iter().fold(self.base, |acc, s| s.apply(acc, self.base));
|
||||||
self.value = value;
|
self.value = value;
|
||||||
|
self.max = value;
|
||||||
|
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
@ -120,7 +121,6 @@ pub struct Cryp {
|
|||||||
pub blue_shield: CrypStat,
|
pub blue_shield: CrypStat,
|
||||||
pub blue_damage: CrypStat,
|
pub blue_damage: CrypStat,
|
||||||
pub speed: CrypStat,
|
pub speed: CrypStat,
|
||||||
pub stamina: CrypStat,
|
|
||||||
pub hp: CrypStat,
|
pub hp: CrypStat,
|
||||||
pub evasion: CrypStat,
|
pub evasion: CrypStat,
|
||||||
pub xp: u64,
|
pub xp: u64,
|
||||||
@ -143,14 +143,13 @@ impl Cryp {
|
|||||||
return Cryp {
|
return Cryp {
|
||||||
id,
|
id,
|
||||||
account: id,
|
account: id,
|
||||||
red_damage: CrypStat { base: 0, value: 0, stat: Stat::RedDamage },
|
red_damage: CrypStat { base: 0, value: 0, max: 0, stat: Stat::RedDamage },
|
||||||
red_shield: CrypStat { base: 0, value: 0, stat: Stat::RedShield },
|
red_shield: CrypStat { base: 0, value: 0, max: 0, stat: Stat::RedShield },
|
||||||
blue_damage: CrypStat { base: 0, value: 0, stat: Stat::BlueDamage },
|
blue_damage: CrypStat { base: 0, value: 0, max: 0, stat: Stat::BlueDamage },
|
||||||
blue_shield: CrypStat { base: 0, value: 0, stat: Stat::BlueShield },
|
blue_shield: CrypStat { base: 0, value: 0, max: 0, stat: Stat::BlueShield },
|
||||||
speed: CrypStat { base: 0, value: 0, stat: Stat::Speed },
|
speed: CrypStat { base: 0, value: 0, max: 0, stat: Stat::Speed },
|
||||||
stamina: CrypStat { base: 0, value: 0, stat: Stat::Stamina },
|
hp: CrypStat { base: 0, value: 0, max: 0, stat: Stat::Hp },
|
||||||
hp: CrypStat { base: 0, value: 0, stat: Stat::Hp },
|
evasion: CrypStat { base: 0, value: 0, max: 0, stat: Stat::Evasion },
|
||||||
evasion: CrypStat { base: 0, value: 0, stat: Stat::Evasion },
|
|
||||||
lvl: 0,
|
lvl: 0,
|
||||||
xp: 0,
|
xp: 0,
|
||||||
skills: vec![],
|
skills: vec![],
|
||||||
@ -225,10 +224,7 @@ impl Cryp {
|
|||||||
Stat::RedDamage => self.red_damage.set(rng.gen_range(stat_min, stat_max), &self.specs),
|
Stat::RedDamage => self.red_damage.set(rng.gen_range(stat_min, stat_max), &self.specs),
|
||||||
Stat::BlueDamage => self.blue_damage.set(rng.gen_range(stat_min, stat_max), &self.specs),
|
Stat::BlueDamage => self.blue_damage.set(rng.gen_range(stat_min, stat_max), &self.specs),
|
||||||
Stat::Speed => self.speed.set(rng.gen_range(stat_min, stat_max), &self.specs),
|
Stat::Speed => self.speed.set(rng.gen_range(stat_min, stat_max), &self.specs),
|
||||||
Stat::Stamina => {
|
Stat::Hp => self.hp.set(rng.gen_range(stam_min, stam_max), &self.specs),
|
||||||
self.stamina.set(rng.gen_range(stam_min, stam_max), &self.specs);
|
|
||||||
self.hp.set(self.stamina.base, &self.specs)
|
|
||||||
},
|
|
||||||
Stat::BlueShield => self.blue_shield.set(rng.gen_range(stat_min, stat_max), &self.specs),
|
Stat::BlueShield => self.blue_shield.set(rng.gen_range(stat_min, stat_max), &self.specs),
|
||||||
Stat::RedShield => self.red_shield.set(rng.gen_range(stat_min, stat_max), &self.specs),
|
Stat::RedShield => self.red_shield.set(rng.gen_range(stat_min, stat_max), &self.specs),
|
||||||
Stat::Evasion => self.evasion.set(rng.gen_range(evasion_min, evasion_max), &self.specs),
|
Stat::Evasion => self.evasion.set(rng.gen_range(evasion_min, evasion_max), &self.specs),
|
||||||
@ -249,7 +245,7 @@ impl Cryp {
|
|||||||
self.roll_stat(Stat::RedDamage);
|
self.roll_stat(Stat::RedDamage);
|
||||||
self.roll_stat(Stat::BlueDamage);
|
self.roll_stat(Stat::BlueDamage);
|
||||||
self.roll_stat(Stat::Speed);
|
self.roll_stat(Stat::Speed);
|
||||||
self.roll_stat(Stat::Stamina);
|
self.roll_stat(Stat::Hp);
|
||||||
|
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
@ -276,10 +272,7 @@ impl Cryp {
|
|||||||
self.blue_shield.recalculate(&self.specs);
|
self.blue_shield.recalculate(&self.specs);
|
||||||
self.evasion.recalculate(&self.specs);
|
self.evasion.recalculate(&self.specs);
|
||||||
self.speed.recalculate(&self.specs);
|
self.speed.recalculate(&self.specs);
|
||||||
|
self.hp.recalculate(&self.specs);
|
||||||
// special case where hp is tied to stam
|
|
||||||
self.stamina.recalculate(&self.specs);
|
|
||||||
self.hp.set(self.stamina.value, &self.specs);
|
|
||||||
|
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
@ -406,7 +399,7 @@ impl Cryp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// pub fn rez(&mut self) -> &mut Cryp {
|
// pub fn rez(&mut self) -> &mut Cryp {
|
||||||
// self.hp.set(self.stamina.base);
|
// self.hp.set(self.hp.base);
|
||||||
// self
|
// self
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@ -449,10 +442,6 @@ impl Cryp {
|
|||||||
self.hp.value
|
self.hp.value
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn stamina(&self) -> u64 {
|
|
||||||
self.stamina.value
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn heal(&mut self, skill: Skill, amount: u64) -> ResolutionResult {
|
pub fn heal(&mut self, skill: Skill, amount: u64) -> ResolutionResult {
|
||||||
let immunity = self.immune(skill);
|
let immunity = self.immune(skill);
|
||||||
let immune = immunity.immune;
|
let immune = immunity.immune;
|
||||||
@ -478,7 +467,7 @@ impl Cryp {
|
|||||||
let current_hp = self.hp();
|
let current_hp = self.hp();
|
||||||
let new_hp = *[
|
let new_hp = *[
|
||||||
self.hp().saturating_add(modified_healing),
|
self.hp().saturating_add(modified_healing),
|
||||||
self.stamina()
|
self.hp.max
|
||||||
].iter().min().unwrap();
|
].iter().min().unwrap();
|
||||||
|
|
||||||
let healing = new_hp - current_hp;
|
let healing = new_hp - current_hp;
|
||||||
@ -597,7 +586,7 @@ impl Cryp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let mut rng = thread_rng();
|
let mut rng = thread_rng();
|
||||||
let hp_pct = (self.hp.value * 100) / self.stamina.value;
|
let hp_pct = (self.hp.value * 100) / self.hp.value;
|
||||||
let evasion_rating = (self.evasion.value * hp_pct) / 100;
|
let evasion_rating = (self.evasion.value * hp_pct) / 100;
|
||||||
let roll = rng.gen_range(0, 100);
|
let roll = rng.gen_range(0, 100);
|
||||||
println!("{:} < {:?}", roll, evasion_rating);
|
println!("{:} < {:?}", roll, evasion_rating);
|
||||||
|
|||||||
@ -402,7 +402,7 @@ pub fn instance_join(params: InstanceJoinParams, tx: &mut Transaction, account:
|
|||||||
|
|
||||||
let mut player = Player::new(account.id, instance.id, cryps);
|
let mut player = Player::new(account.id, instance.id, cryps);
|
||||||
player.vbox.fill();
|
player.vbox.fill();
|
||||||
player_create(tx, &player, account)?;
|
let player = player_create(tx, player, account)?;
|
||||||
|
|
||||||
instance.add_player(player.clone());
|
instance.add_player(player.clone());
|
||||||
|
|
||||||
@ -475,7 +475,6 @@ pub fn instance_game_finished(tx: &mut Transaction, game: &Game, instance_id: Uu
|
|||||||
true => player.add_win(),
|
true => player.add_win(),
|
||||||
false => player.add_loss(),
|
false => player.add_loss(),
|
||||||
};
|
};
|
||||||
println!("{:?}", player);
|
|
||||||
player_update(tx, player, true)?;
|
player_update(tx, player, true)?;
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,7 +20,7 @@ pub enum ItemAction {
|
|||||||
RerollRedDamage,
|
RerollRedDamage,
|
||||||
RerollBlueDamage,
|
RerollBlueDamage,
|
||||||
RerollSpeed,
|
RerollSpeed,
|
||||||
RerollStamina,
|
RerollHp,
|
||||||
RerollRedShield,
|
RerollRedShield,
|
||||||
RerollBlueShield,
|
RerollBlueShield,
|
||||||
RerollEvasion,
|
RerollEvasion,
|
||||||
@ -52,7 +52,7 @@ impl Item {
|
|||||||
|
|
||||||
fn apply(&mut self, tx: &mut Transaction, target: Uuid) -> Result<(), Error> {
|
fn apply(&mut self, tx: &mut Transaction, target: Uuid) -> Result<(), Error> {
|
||||||
match self.action {
|
match self.action {
|
||||||
ItemAction::RerollStamina => reroll(self, tx, target, Stat::Stamina),
|
ItemAction::RerollHp => reroll(self, tx, target, Stat::Hp),
|
||||||
ItemAction::RerollRedDamage => reroll(self, tx, target, Stat::RedDamage),
|
ItemAction::RerollRedDamage => reroll(self, tx, target, Stat::RedDamage),
|
||||||
ItemAction::RerollBlueDamage => reroll(self, tx, target, Stat::BlueDamage),
|
ItemAction::RerollBlueDamage => reroll(self, tx, target, Stat::BlueDamage),
|
||||||
ItemAction::RerollSpeed => reroll(self, tx, target, Stat::Speed),
|
ItemAction::RerollSpeed => reroll(self, tx, target, Stat::Speed),
|
||||||
@ -85,7 +85,7 @@ fn reroll(item: &mut Item, tx: &mut Transaction, target: Uuid, stat: Stat) -> Re
|
|||||||
fn mode_drops(mode: GameMode) -> Vec<(ItemAction, usize)> {
|
fn mode_drops(mode: GameMode) -> Vec<(ItemAction, usize)> {
|
||||||
match mode {
|
match mode {
|
||||||
GameMode::Normal => vec![
|
GameMode::Normal => vec![
|
||||||
(ItemAction::RerollStamina, 1),
|
(ItemAction::RerollHp, 1),
|
||||||
(ItemAction::RerollRedDamage, 1),
|
(ItemAction::RerollRedDamage, 1),
|
||||||
(ItemAction::RerollBlueDamage, 1),
|
(ItemAction::RerollBlueDamage, 1),
|
||||||
],
|
],
|
||||||
@ -103,7 +103,7 @@ fn mode_drops(mode: GameMode) -> Vec<(ItemAction, usize)> {
|
|||||||
(ItemAction::RerollSpeed, 1),
|
(ItemAction::RerollSpeed, 1),
|
||||||
],
|
],
|
||||||
// _ => vec![
|
// _ => vec![
|
||||||
// (ItemAction::RerollStamina, 1),
|
// (ItemAction::RerollHp, 1),
|
||||||
// (ItemAction::RerollRedDamage, 1),
|
// (ItemAction::RerollRedDamage, 1),
|
||||||
// (ItemAction::RerollBlueDamage, 1),
|
// (ItemAction::RerollBlueDamage, 1),
|
||||||
// (ItemAction::RerollSpeed, 1),
|
// (ItemAction::RerollSpeed, 1),
|
||||||
|
|||||||
@ -94,7 +94,7 @@ pub fn player_get(tx: &mut Transaction, account_id: Uuid, instance_id: Uuid) ->
|
|||||||
return Ok(data);
|
return Ok(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn player_create(tx: &mut Transaction, player: &Player, account: &Account) -> Result<(), Error> {
|
pub fn player_create(tx: &mut Transaction, player: Player, account: &Account) -> Result<Player, Error> {
|
||||||
let player_bytes = to_vec(&player)?;
|
let player_bytes = to_vec(&player)?;
|
||||||
|
|
||||||
let query = "
|
let query = "
|
||||||
@ -110,7 +110,7 @@ pub fn player_create(tx: &mut Transaction, player: &Player, account: &Account) -
|
|||||||
|
|
||||||
println!("wrote player {:} joined instance: {:}", account.name, player.instance);
|
println!("wrote player {:} joined instance: {:}", account.name, player.instance);
|
||||||
|
|
||||||
return Ok(());
|
return Ok(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn player_update(tx: &mut Transaction, player: Player, ignore_phase: bool) -> Result<Player, Error> {
|
pub fn player_update(tx: &mut Transaction, player: Player, ignore_phase: bool) -> Result<Player, Error> {
|
||||||
@ -168,14 +168,18 @@ pub fn player_cryps_set(params: PlayerCrypsSetParams, tx: &mut Transaction, acco
|
|||||||
return Err(err_msg("team size is 3"));
|
return Err(err_msg("team size is 3"));
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut player = player_get(tx, account.id, Uuid::nil())?;
|
|
||||||
|
|
||||||
let cryps = params.cryp_ids
|
let cryps = params.cryp_ids
|
||||||
.iter()
|
.iter()
|
||||||
.map(|id| cryp_get(tx, *id, account.id))
|
.map(|id| cryp_get(tx, *id, account.id))
|
||||||
.collect::<Result<Vec<Cryp>, Error>>()?;
|
.collect::<Result<Vec<Cryp>, Error>>()?;
|
||||||
|
|
||||||
player.cryps = cryps;
|
match player_get(tx, account.id, Uuid::nil()) {
|
||||||
|
Ok(mut p) => {
|
||||||
player_update(tx, player, false)
|
p.cryps = cryps;
|
||||||
|
player_update(tx, p, false)
|
||||||
|
},
|
||||||
|
Err(_) => {
|
||||||
|
return player_create(tx, Player::new(account.id, Uuid::nil(), cryps), &account)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,7 +21,7 @@ use account::{Account, account_create, account_login, account_from_token, accoun
|
|||||||
use skill::{Skill};
|
use skill::{Skill};
|
||||||
// use zone::{Zone, zone_create, zone_join, zone_close};
|
// use zone::{Zone, zone_create, zone_join, zone_close};
|
||||||
use spec::{Spec};
|
use spec::{Spec};
|
||||||
use player::{player_state, player_create, player_cryps_set, Player};
|
use player::{player_state, player_cryps_set, Player};
|
||||||
use instance::{instance_join, instance_ready};
|
use instance::{instance_join, instance_ready};
|
||||||
use vbox::{vbox_accept, vbox_apply, vbox_discard, vbox_combine, vbox_drop};
|
use vbox::{vbox_accept, vbox_apply, vbox_discard, vbox_combine, vbox_drop};
|
||||||
|
|
||||||
@ -163,8 +163,6 @@ impl Rpc {
|
|||||||
let msg = from_slice::<AccountCreateMsg>(&data).or(Err(err_msg("invalid params")))?;
|
let msg = from_slice::<AccountCreateMsg>(&data).or(Err(err_msg("invalid params")))?;
|
||||||
|
|
||||||
let account = account_create(msg.params, tx)?;
|
let account = account_create(msg.params, tx)?;
|
||||||
let player = Player::new(account.id, Uuid::nil(), vec![]);
|
|
||||||
player_create(tx, &player, &account)?;
|
|
||||||
|
|
||||||
Ok(RpcResponse {
|
Ok(RpcResponse {
|
||||||
method: "account_create".to_string(),
|
method: "account_create".to_string(),
|
||||||
@ -198,9 +196,6 @@ impl Rpc {
|
|||||||
let name: String = iter::repeat(()).map(|()| rng.sample(Alphanumeric)).take(8).collect();
|
let name: String = iter::repeat(()).map(|()| rng.sample(Alphanumeric)).take(8).collect();
|
||||||
cryp_spawn(CrypSpawnParams { name }, tx, &account)?;
|
cryp_spawn(CrypSpawnParams { name }, tx, &account)?;
|
||||||
|
|
||||||
let player = Player::new(account.id, Uuid::nil(), vec![]);
|
|
||||||
player_create(tx, &player, &account)?;
|
|
||||||
|
|
||||||
let res = RpcResponse {
|
let res = RpcResponse {
|
||||||
method: "account_create".to_string(),
|
method: "account_create".to_string(),
|
||||||
params: RpcResult::Account(account),
|
params: RpcResult::Account(account),
|
||||||
|
|||||||
@ -1045,7 +1045,7 @@ mod tests {
|
|||||||
|
|
||||||
y.reduce_effect_durations(&mut log);
|
y.reduce_effect_durations(&mut log);
|
||||||
let _decay = y.effects.iter().find(|e| e.effect == Effect::Decay);
|
let _decay = y.effects.iter().find(|e| e.effect == Effect::Decay);
|
||||||
// assert!(y.hp() == y.stamina().saturating_sub(decay.unwrap().tick.unwrap().amount));
|
// assert!(y.hp() == y.hp().saturating_sub(decay.unwrap().tick.unwrap().amount));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@ -1,38 +1,59 @@
|
|||||||
|
use rand::prelude::*;
|
||||||
|
|
||||||
use cryp::{Stat};
|
use cryp::{Stat};
|
||||||
|
|
||||||
#[derive(Debug,Copy,Clone,Serialize,Deserialize,PartialEq)]
|
#[derive(Debug,Copy,Clone,Serialize,Deserialize,PartialEq)]
|
||||||
pub enum Spec {
|
pub enum Spec {
|
||||||
SpeedI,
|
SpeedI,
|
||||||
StaminaI,
|
|
||||||
|
LifeI,
|
||||||
|
RedShieldI,
|
||||||
|
BlueShieldI,
|
||||||
|
LRSI,
|
||||||
|
LBSI,
|
||||||
|
RBSI,
|
||||||
|
|
||||||
RedDamageI,
|
RedDamageI,
|
||||||
GreenDamageI,
|
GreenDamageI,
|
||||||
BlueDamageI,
|
BlueDamageI,
|
||||||
RedShieldI,
|
|
||||||
BlueShieldI,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Spec {
|
impl Spec {
|
||||||
pub fn affects(&self) -> Stat {
|
pub fn affects(&self) -> Vec<Stat> {
|
||||||
match *self {
|
match *self {
|
||||||
Spec::RedDamageI => Stat::RedDamage,
|
Spec::RedDamageI => vec![Stat::RedDamage],
|
||||||
Spec::GreenDamageI => Stat::GreenDamage,
|
Spec::GreenDamageI => vec![Stat::GreenDamage],
|
||||||
Spec::BlueDamageI => Stat::BlueDamage,
|
Spec::BlueDamageI => vec![Stat::BlueDamage],
|
||||||
Spec::RedShieldI => Stat::RedShield,
|
Spec::RedShieldI => vec![Stat::RedShield],
|
||||||
Spec::BlueShieldI => Stat::BlueShield,
|
Spec::BlueShieldI => vec![Stat::BlueShield],
|
||||||
Spec::SpeedI => Stat::Speed,
|
Spec::SpeedI => vec![Stat::Speed],
|
||||||
Spec::StaminaI => Stat::Stamina,
|
Spec::LifeI => vec![Stat::Hp],
|
||||||
|
Spec::LRSI => vec![Stat::Hp, Stat::RedShield],
|
||||||
|
Spec::LBSI => vec![Stat::Hp, Stat::BlueShield],
|
||||||
|
Spec::RBSI => vec![Stat::BlueShield, Stat::RedShield],
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn apply(&self, modified: u64, base: u64) -> u64 {
|
pub fn apply(&self, modified: u64, base: u64) -> u64 {
|
||||||
|
let mut rng = thread_rng();
|
||||||
|
|
||||||
|
let i_min = 32;
|
||||||
|
let i_max = 64;
|
||||||
|
|
||||||
match *self {
|
match *self {
|
||||||
Spec::RedDamageI => modified + (base * 5 / 100),
|
Spec::RedDamageI => modified + (base * 5 / 100),
|
||||||
Spec::GreenDamageI => modified + (base * 5 / 100),
|
Spec::GreenDamageI => modified + (base * 5 / 100),
|
||||||
Spec::BlueDamageI => modified + (base * 5 / 100),
|
Spec::BlueDamageI => modified + (base * 5 / 100),
|
||||||
|
|
||||||
Spec::SpeedI => modified + (base * 5 / 100),
|
Spec::SpeedI => modified + (base * 5 / 100),
|
||||||
Spec::StaminaI => modified + (base * 5 / 100),
|
|
||||||
Spec::RedShieldI => modified + 50,
|
Spec::LifeI => modified + (base * 5 / 100),
|
||||||
Spec::BlueShieldI => modified + 50,
|
Spec::RedShieldI => modified + rng.gen_range(i_min, i_max),
|
||||||
|
Spec::BlueShieldI => modified + rng.gen_range(i_min, i_max),
|
||||||
|
Spec::LRSI => modified + (base * 5 / 100),
|
||||||
|
Spec::LBSI => modified + (base * 5 / 100),
|
||||||
|
Spec::RBSI => modified + (base * 5 / 100),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -33,17 +33,19 @@ pub enum Var {
|
|||||||
|
|
||||||
// specs
|
// specs
|
||||||
Damage,
|
Damage,
|
||||||
Protection,
|
|
||||||
Speed,
|
|
||||||
Hp,
|
Hp,
|
||||||
|
Speed,
|
||||||
|
|
||||||
|
LifeI,
|
||||||
|
LRSI,
|
||||||
|
LBSI,
|
||||||
|
RBSI,
|
||||||
|
|
||||||
StaminaI,
|
|
||||||
RedDamageI,
|
RedDamageI,
|
||||||
BlueDamageI,
|
BlueDamageI,
|
||||||
GreenDamageI,
|
GreenDamageI,
|
||||||
RedShieldI,
|
RedShieldI,
|
||||||
BlueShieldI,
|
BlueShieldI,
|
||||||
SpeedI,
|
|
||||||
|
|
||||||
Amplify,
|
Amplify,
|
||||||
Banish,
|
Banish,
|
||||||
@ -87,91 +89,70 @@ impl Var {
|
|||||||
Var::Debuff |
|
Var::Debuff |
|
||||||
Var::Buff => true,
|
Var::Buff => true,
|
||||||
|
|
||||||
Var::Protection |
|
Var::Hp |
|
||||||
Var::Damage => true,
|
Var::Damage => true,
|
||||||
|
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn effect(&self) -> Result<VarEffect, Error> {
|
fn effect(&self) -> Option<VarEffect> {
|
||||||
|
if let Some(_skill) = self.skill() {
|
||||||
|
return Some(VarEffect::Skill);
|
||||||
|
}
|
||||||
|
if let Some(_spec) = self.spec() {
|
||||||
|
return Some(VarEffect::Spec);
|
||||||
|
}
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn skill(&self) -> Option<Skill> {
|
||||||
match self {
|
match self {
|
||||||
Var::Amplify |
|
Var::Amplify => Some(Skill::Amplify),
|
||||||
Var::Banish |
|
Var::Banish => Some(Skill::Banish),
|
||||||
Var::Blast |
|
Var::Blast => Some(Skill::Blast),
|
||||||
Var::Curse |
|
Var::Curse => Some(Skill::Curse),
|
||||||
Var::Empower |
|
Var::Empower => Some(Skill::Empower),
|
||||||
Var::Haste |
|
Var::Haste => Some(Skill::Haste),
|
||||||
Var::Heal |
|
Var::Heal => Some(Skill::Heal),
|
||||||
Var::Hex |
|
Var::Hex => Some(Skill::Hex),
|
||||||
Var::Parry |
|
Var::Parry => Some(Skill::Parry),
|
||||||
Var::Purge |
|
Var::Purge => Some(Skill::Purge),
|
||||||
Var::Purify |
|
Var::Purify => Some(Skill::Purify),
|
||||||
// Var::Reflect |
|
// Var::Reflect => Some(Skill::Reflect),
|
||||||
Var::Ruin |
|
Var::Ruin => Some(Skill::Ruin),
|
||||||
Var::Shield |
|
Var::Shield => Some(Skill::Shield),
|
||||||
Var::Silence |
|
Var::Silence => Some(Skill::Silence),
|
||||||
Var::Slay |
|
Var::Slay => Some(Skill::Slay),
|
||||||
Var::Slow |
|
Var::Slow => Some(Skill::Slow),
|
||||||
Var::Snare |
|
Var::Snare => Some(Skill::Snare),
|
||||||
Var::Strangle |
|
Var::Strangle => Some(Skill::Strangle),
|
||||||
Var::Strike |
|
Var::Strike => Some(Skill::Strike),
|
||||||
// Var::Clutch |
|
// Var::Clutch => Some(Skill::Clutch),
|
||||||
// Var::Taunt |
|
// Var::Taunt => Some(Skill::Taunt),
|
||||||
Var::Throw |
|
Var::Throw => Some(Skill::Throw),
|
||||||
// Var::Toxic |
|
// Var::Toxic => Some(Skill::Toxic),
|
||||||
Var::Triage => Ok(VarEffect::Skill),
|
Var::Triage => Some(Skill::Triage),
|
||||||
|
_ => None,
|
||||||
Var::StaminaI |
|
|
||||||
Var::RedShieldI |
|
|
||||||
Var::BlueShieldI |
|
|
||||||
Var::SpeedI => Ok(VarEffect::Spec),
|
|
||||||
|
|
||||||
_ => Err(err_msg("var has no effect on cryps"))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn skill(&self) -> Skill {
|
fn spec(&self) -> Option<Spec> {
|
||||||
match self {
|
|
||||||
Var::Amplify => Skill::Amplify,
|
|
||||||
Var::Banish => Skill::Banish,
|
|
||||||
Var::Blast => Skill::Blast,
|
|
||||||
Var::Curse => Skill::Curse,
|
|
||||||
Var::Empower => Skill::Empower,
|
|
||||||
Var::Haste => Skill::Haste,
|
|
||||||
Var::Heal => Skill::Heal,
|
|
||||||
Var::Hex => Skill::Hex,
|
|
||||||
Var::Parry => Skill::Parry,
|
|
||||||
Var::Purge => Skill::Purge,
|
|
||||||
Var::Purify => Skill::Purify,
|
|
||||||
// Var::Reflect => Skill::Reflect,
|
|
||||||
Var::Ruin => Skill::Ruin,
|
|
||||||
Var::Shield => Skill::Shield,
|
|
||||||
Var::Silence => Skill::Silence,
|
|
||||||
Var::Slay => Skill::Slay,
|
|
||||||
Var::Slow => Skill::Slow,
|
|
||||||
Var::Snare => Skill::Snare,
|
|
||||||
Var::Strangle => Skill::Strangle,
|
|
||||||
Var::Strike => Skill::Strike,
|
|
||||||
// Var::Clutch => Skill::Clutch,
|
|
||||||
// Var::Taunt => Skill::Taunt,
|
|
||||||
Var::Throw => Skill::Throw,
|
|
||||||
// Var::Toxic => Skill::Toxic,
|
|
||||||
Var::Triage => Skill::Triage,
|
|
||||||
_ => panic!("not a skill var"),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn spec(&self) -> Spec {
|
|
||||||
match *self {
|
match *self {
|
||||||
Var::StaminaI => Spec::StaminaI,
|
Var::Speed => Some(Spec::SpeedI),
|
||||||
Var::SpeedI => Spec::SpeedI,
|
|
||||||
Var::RedDamageI => Spec::RedDamageI,
|
Var::RedDamageI => Some(Spec::RedDamageI),
|
||||||
Var::BlueDamageI => Spec::BlueDamageI,
|
Var::BlueDamageI => Some(Spec::BlueDamageI),
|
||||||
Var::GreenDamageI => Spec::GreenDamageI,
|
Var::GreenDamageI => Some(Spec::GreenDamageI),
|
||||||
Var::RedShieldI => Spec::RedShieldI,
|
|
||||||
Var::BlueShieldI => Spec::BlueShieldI,
|
Var::LifeI => Some(Spec::LifeI),
|
||||||
_ => panic!("not a spec var"),
|
Var::LRSI => Some(Spec::LRSI),
|
||||||
|
Var::LBSI => Some(Spec::LBSI),
|
||||||
|
Var::RBSI => Some(Spec::RBSI),
|
||||||
|
Var::RedShieldI => Some(Spec::RedShieldI),
|
||||||
|
Var::BlueShieldI => Some(Spec::BlueShieldI),
|
||||||
|
|
||||||
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -202,8 +183,8 @@ impl Vbox {
|
|||||||
Var::Attack,
|
Var::Attack,
|
||||||
Var::Attack,
|
Var::Attack,
|
||||||
Var::Attack,
|
Var::Attack,
|
||||||
Var::StaminaI,
|
Var::Hp,
|
||||||
Var::SpeedI,
|
Var::Speed,
|
||||||
Var::Damage,
|
Var::Damage,
|
||||||
Var::Red,
|
Var::Red,
|
||||||
Var::Green,
|
Var::Green,
|
||||||
@ -241,9 +222,8 @@ impl Vbox {
|
|||||||
|
|
||||||
let specs = vec![
|
let specs = vec![
|
||||||
(Var::Damage, 1),
|
(Var::Damage, 1),
|
||||||
(Var::Protection, 1),
|
|
||||||
(Var::Speed, 1),
|
|
||||||
(Var::Hp, 1),
|
(Var::Hp, 1),
|
||||||
|
(Var::Speed, 1),
|
||||||
];
|
];
|
||||||
|
|
||||||
let mut rng = thread_rng();
|
let mut rng = thread_rng();
|
||||||
@ -385,16 +365,15 @@ impl Vbox {
|
|||||||
ColourCode::GB => return Err(err_msg("unhandled skill combo")),
|
ColourCode::GB => return Err(err_msg("unhandled skill combo")),
|
||||||
ColourCode::BR => return Err(err_msg("unhandled skill combo")),
|
ColourCode::BR => return Err(err_msg("unhandled skill combo")),
|
||||||
},
|
},
|
||||||
Var::Protection => match colour_code {
|
Var::Hp => match colour_code {
|
||||||
ColourCode::RR => Var::RedShieldI,
|
ColourCode::RR => Var::RedShieldI,
|
||||||
ColourCode::GG => return Err(err_msg("unhandled skill combo")),
|
ColourCode::GG => Var::LifeI,
|
||||||
ColourCode::BB => Var::BlueShieldI,
|
ColourCode::BB => Var::BlueShieldI,
|
||||||
ColourCode::RG => return Err(err_msg("unhandled skill combo")),
|
ColourCode::RG => Var::LRSI,
|
||||||
ColourCode::GB => return Err(err_msg("unhandled skill combo")),
|
ColourCode::GB => Var::LBSI,
|
||||||
ColourCode::BR => return Err(err_msg("unhandled skill combo")),
|
ColourCode::BR => Var::RBSI,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
_ => panic!("wrong base {:?}", base),
|
_ => panic!("wrong base {:?}", base),
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -432,9 +411,9 @@ pub fn vbox_apply(params: VboxApplyParams, tx: &mut Transaction, account: &Accou
|
|||||||
let mut player = player_get(tx, account.id, params.instance_id)?;
|
let mut player = player_get(tx, account.id, params.instance_id)?;
|
||||||
let var = player.vbox.bound.remove(params.index);
|
let var = player.vbox.bound.remove(params.index);
|
||||||
|
|
||||||
match var.effect()? {
|
match var.effect() {
|
||||||
VarEffect::Skill => {
|
Some(VarEffect::Skill) => {
|
||||||
let skill = var.skill();
|
let skill = var.skill().ok_or(format_err!("var {:?} has no associated skill", var))?;
|
||||||
let cryp = player.cryp_get(params.cryp_id)?;
|
let cryp = player.cryp_get(params.cryp_id)?;
|
||||||
// done here because i teach them a tonne of skills for tests
|
// done here because i teach them a tonne of skills for tests
|
||||||
let max_skills = 4;
|
let max_skills = 4;
|
||||||
@ -444,12 +423,13 @@ pub fn vbox_apply(params: VboxApplyParams, tx: &mut Transaction, account: &Accou
|
|||||||
|
|
||||||
cryp.learn_mut(skill);
|
cryp.learn_mut(skill);
|
||||||
},
|
},
|
||||||
VarEffect::Spec => {
|
Some(VarEffect::Spec) => {
|
||||||
let spec = var.spec();
|
let spec = var.spec().ok_or(format_err!("var {:?} has no associated spec", var))?;
|
||||||
let cryp = player.cryp_get(params.cryp_id)?;
|
let cryp = player.cryp_get(params.cryp_id)?;
|
||||||
cryp.spec_add(spec)?;
|
cryp.spec_add(spec)?;
|
||||||
|
|
||||||
},
|
},
|
||||||
|
None => return Err(err_msg("var has no effect on cryps")),
|
||||||
}
|
}
|
||||||
|
|
||||||
return player_update(tx, player, false);
|
return player_update(tx, player, false);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user