You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
716 B
28 lines
716 B
class Attack {
|
|
constructor(percentRange = 1) {
|
|
if (percentRange > 1 / 3) {
|
|
if (percentRange > 2 / 3) {
|
|
percentRange = 1;
|
|
this.percentBonus = 1;
|
|
} else {
|
|
percentRange = 2 / 3;
|
|
this.percentBonus = 1.5;
|
|
}
|
|
} else {
|
|
percentRange = 1 / 3;
|
|
this.percentBonus = 2;
|
|
}
|
|
this.percentRange = percentRange;
|
|
}
|
|
|
|
do(robot) {
|
|
if (robot.haveTarget() && robot.isTargetInRange(this.percentRange)) {
|
|
return robot.attackTarget(this.percentBonus);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
getFrame() {
|
|
return this.percentRange * 3 - 1;
|
|
}
|
|
} |