Skip to content

Commit

Permalink
Improve players dont hit each other
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexsandr0x committed Mar 8, 2019
1 parent 99cf1db commit 2a55597
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
34 changes: 34 additions & 0 deletions players/experimental/BaseMidfielder.js
Original file line number Diff line number Diff line change
@@ -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 () {}
}
4 changes: 3 additions & 1 deletion players/experimental/MidFieldAttacker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand Down
3 changes: 2 additions & 1 deletion players/experimental/MidFieldDefender.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand Down

0 comments on commit 2a55597

Please sign in to comment.