Public
Edited
Jan 18, 2022
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
class Player{
constructor(data){
this.id = DOM.uid("player").id;
this.name = data.name;
this.team = data.team;
this.race = data.race;
this.assigment = data.assigment;
this.Experience = {Throw:0, Catch:0};
this.IsBallCarrier = false;
[this.velocity, this.radius, this.characteristics] = getRaceAttributs(data.race);
this.pos = SetInitialPlayerPosition(data.assigment);
this.dir = new Vector(1, 0).normalize();
this.normal = this.dir.clone().normal();

}
Move(x, y){
this.x = x;
this.y = y;
}
ThrowBall(to, difficulty){
var dice = randBetween(1,20);
var res = dice + this.characteristics.Throw + this.Experience.Throw - difficulty - getModDistance(this.position, to) - 10;
}
CatchBall(source, difficulty){
var dice = randBetween(1,20);
}
}
Insert cell
getRaceAttributs = (race) => {
let attributs = [];
switch(race) {
case 'goblin':
attributs = [7, 12, Object({strength:0, decterity:0,constitution:0, intelligence:0, wisdom:0, charism:0})];
break;
case 'dwarf':
attributs = [7, 12, Object({strength:0, decterity:0,constitution:0, intelligence:0, wisdom:0, charism:0})];
break;
case 'elf':
attributs = [7, 14, Object({strength:0, decterity:0,constitution:0, intelligence:0, wisdom:0, charism:0})];
break;
default: // human
attributs = [7, 14, Object({strength:0, decterity:0,constitution:0, intelligence:0, wisdom:0, charism:0})];
}
return attributs
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more