-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve fighting #402
Improve fighting #402
Conversation
src/prototype_room_attack.js
Outdated
* | ||
* USAGE: get a Room Object then .attack42('targetRoomName') | ||
* e.g. Game.rooms[Memory.myRooms[0]].attack42('targetRoomName'); | ||
* TODO add an attack42 event if invader is seen by reserver, sourcer or carry | ||
* e.g. `Game.rooms[Memory.myRooms[0]].attack42('targetRoomName')``;. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why thuses ```at start and end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'`' usually marks executable code
src/prototype_creep_fight.js
Outdated
if (pos.lookFor(LOOK_TERRAIN)[0] !== STRUCTURE_WALL && pos.lookFor(LOOK_CREEPS).length === 0) { | ||
direction = direction + offset; | ||
if (!pos.checkForWall() && pos.lookFor(LOOK_CREEPS).length === 0) { | ||
direction = (direction + offset) % 8 + 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
= dir
:) or l23 : direction = (direction + 1) % 8 + 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thx
src/prototype_room_attack.js
Outdated
player.lastAttacked = Game.time; | ||
Memory.players[player.name] = player; | ||
} | ||
const lastAttacked = player.lastAttacked; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not really need to be declared i think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thx
attacks[`attack${player.level}`](this); | ||
player.counter++; | ||
if (player.counter > 10) { | ||
player.level += 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can reach lvl 2 and stop attack.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every level is triggered 10 times before changing to the next level
@@ -57,6 +80,7 @@ roles.scout.execute = function(creep) { | |||
creep.memory.skip.push(creep.memory.search.target); | |||
delete creep.memory.scoutSkip; | |||
} else { | |||
checkForDefender(creep); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be better drop a defender on all rooms linked to reserved one no? the issue i supose with your logic is that get linear distance may focus rooms which are further than expected if some exits are closed. could use search.level I supose with level <= 2 but it will defend all roms around level 1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Defenders are called for rooms with linear distance 1 (https://github.com/TooAngel/screeps/pull/402/files#diff-362993a173ef9b2bb120bc815a19a4cfR41). Yes in some cases this can be a couple of rooms away, but for the start I think it is fine before getting more sophisticated.
return true; | ||
} | ||
return false; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Creep.proto healMyCreeps may be used here. just need adapt it for findClosest with a new arg.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, true. Don't want to touch it here.
// creep.log('Execute!!!'); | ||
creep.log('Execute!!!'); | ||
creep.heal(creep); | ||
creep.moveRandom(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think it's better to stop use execute no ? Maybe keep a log with debug config check for see if it is launch one day ^^
We should add execute calls to stats for see if we can remove them safely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's why I enabled the log again.
A new review, yeah.
|
- Defend reserved rooms - Autotrigger all attacks: autoattack, squad.start and attack42 Fixes #35
Fixes #35