diff --git a/players/experimental/BaseMidfielder.js b/players/experimental/BaseMidfielder.js new file mode 100644 index 0000000..dc6bbd2 --- /dev/null +++ b/players/experimental/BaseMidfielder.js @@ -0,0 +1,34 @@ +const IntentionPlayer = require('../IntentionPlayer') +const TensorMath = require('../../lib/TensorMath') +const Intention = require('../../Intention') +const LineIntention = require('../../Intention/LineIntention') +const PointIntention = require('../../Intention/PointIntention') +const LookAtIntention = require('../../Intention/LookAtIntention') +const Vector = require('../../lib/Vector') +const RulePlays = require('../experimental/RulePlays') + +module.exports = class BaseMidfielder extends RulePlays { + setup () { + super.setup() + let attacker = () => { + let pos = this.match.gameManager.coach.attackerRobot.robots.self.position + /* + A projeção não é usada nos casos onde: + - Não existe vetor projeção (ocorre no primeiro frame de execução) + - Velocidade da bola inferior a 1.2 cm/s (praticamente parada) + - Quando a bola ira bater longe do gol (acima de 30 cm em relação ao centro do gol) + */ + return pos + } + + this.addIntetion(new PointIntention('avoidPartner', { + target: attacker, + radius: 400, + radiusMax: 400, + decay: TensorMath.new.mult(-1).finish, + multiplier: 160 + })) + + } + loop () {} +} diff --git a/players/experimental/MidFieldAttacker.js b/players/experimental/MidFieldAttacker.js index 5226e44..39ee04b 100644 --- a/players/experimental/MidFieldAttacker.js +++ b/players/experimental/MidFieldAttacker.js @@ -6,10 +6,12 @@ const PointIntention = require('../../Intention/PointIntention') const LookAtIntention = require('../../Intention/LookAtIntention') const Vector = require('../../lib/Vector') const RulePlays = require('./RulePlays') +const BaseMidfielder = require('./BaseMidfielder') + const BASE_SPEED = 50 -module.exports = class Midfielder extends RulePlays { +module.exports = class Midfielder extends BaseMidfielder { setup(){ super.setup() let ball = () => { diff --git a/players/experimental/MidFieldDefender.js b/players/experimental/MidFieldDefender.js index 741d0a3..1b13150 100644 --- a/players/experimental/MidFieldDefender.js +++ b/players/experimental/MidFieldDefender.js @@ -7,10 +7,11 @@ const LookAtIntention = require('../../Intention/LookAtIntention') const OrbitalIntention = require('../../Intention/OrbitalIntention') const Vector = require('../../lib/Vector') const RulePlays = require('./RulePlays') +const BaseMidfielder = require('./BaseMidfielder') const BASE_SPEED = 65 -module.exports = class MidfieldDefender extends RulePlays { +module.exports = class MidfieldDefender extends BaseMidfielder { setup () { super.setup() let ballAntecipation = () => {