-
Notifications
You must be signed in to change notification settings - Fork 104
Change skill logic. second try #93
base: master
Are you sure you want to change the base?
Conversation
index.user.js
Outdated
this.attack(); | ||
} | ||
attack() { | ||
SetMouse(k_nDamagePointx + 50, (APP.renderer.height / 2) + 100); |
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.
Where does this 50 come from? Is it the size of the Meteor sprite?
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.
@TehDmitry ping
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.
k_nDamagePointx + 50 — is just little bit right from left side of screen
index.user.js
Outdated
if (enemy.m_bDead || EnemyWillAffectedByBoulder(enemy) || BlackholeOfEnemy(enemy) != null) | ||
return WORST_SCORE; | ||
|
||
let score = AllEnemiesHPNearPoint(enemy.m_Sprite.x, enemy.m_Sprite.y, 50); |
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.
Where does the 50 come from? Is it the size of the Projectile sprite?
index.user.js
Outdated
} | ||
const AllEnemiesHPNearPoint = function AllEnemiesHPNearPoint(x, y, radius) { | ||
let hp = 0; | ||
EnemyManager().m_rgEnemies.forEach((enemy) => { |
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 am not an expert on JS, but do you really want to execute a forEach
here? Couldn't it be async and hence hp
will always be 0
?
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 you do since m_rgEnemies is a Map object
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.
@meepen so it is guaranteed to not to be async? What about the following approach?
for(var [_, enemy] of EnemyManager().m_rgEnemies) {
// If something
hp += enemy.m_nHealth;
}
changed |
index.user.js
Outdated
@@ -402,7 +408,8 @@ class BombAttack extends ProjectileAttack { | |||
if (enemy.m_bDead || EnemyWillAffectedByBoulder(enemy) || BlackholeOfEnemy(enemy) != null) | |||
return WORST_SCORE; | |||
|
|||
let score = AllEnemiesHPNearPoint(enemy.m_Sprite.x, enemy.m_Sprite.y, 50); | |||
let explosionWidth = GAME.m_State.m_AttackManager.m_rgExplosionFrames[0].width * 0.4; //attack.js:353 value is 204.8 |
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.
Nice find. Instead of * 0.4
you could use GAME.m_State.m_AttackManager.m_rgExplosionFrames[0].scale[1]
can you not?
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.
m_rgExplosionFrames[0] doesn't have the scale property:
console.log(gGame.m_State.m_AttackManager.m_rgExplosionFrames[0].scale)
undefined
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.
Fair enough, you would need to get the AnimatedSprite. Let's Meepen decide.
var explosion = new PIXI.extras.AnimatedSprite(instance.m_rgExplosionFrames );
explosion.animationSpeed = 0.2;
explosion.loop = false;
explosion.play();
explosion.scale.set( 0.4, 0.4 );
explosion.anchor.set( 0.5, 0.5 );
index.user.js
Outdated
const CenterOfSpawnZoneYpos = function CenterOfSpawnZoneX(enemy) { | ||
//slime from enemies.json has scale 0.5 | ||
//texture has height 126 | ||
let minSpriteHeight = 126 * 0.5; |
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't you use enemy.m_Sprite.height
here? Something similar for the scale?
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.
enemy is excess here, fixed
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.
@TehDmitry I am more worried about the 126
and the 0.5
here. Where are they coming from?
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.
https://steamcdn-a.akamaihd.net/steamcommunity/public/assets//saliengame/enemies.json
"slime":{
…
"scale": {
"x":0.5,
"y":0.5
},
PIXI.loader.resources['enemy-spritesheet-0'].textures['Enemy_A_0007.png'].height
126
Is this changes enough? |
@TehDmitry we are getting there! Except for the magic numbers mentioned above, is there a reason why you are overloading |
@EoD because I don't have the target for Meteor and Blackhole attacks |
@EricMue in this branch I don't change coordinates for bomb attack, only enemy scoring for finding best enemy group. |
@meepen what is your take on this? |
I think we are making ideal code instead making fun |
ideal code is fun |
I don't know what they want. |
Ideally you should make multiple requests for the different features, suck
as this and boss support, I recently started to start using user script
again so I will be able to look at these changes again
…On Sat, Jun 30, 2018, 10:57 AM TehDmitry ***@***.***> wrote:
I don't know what they want.
Without approving requests is no motivation to create them. For example I
already have boss support
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#93 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AF5lSadQK6EekDL2S7y-4Wti1kkuXnRVks5uB5HcgaJpZM4U08GY>
.
|
In next minigame I will try to be better. Bot is outdating too fast. I will remind you only two days left for fun. Seems to be too many enterprise-way for this fun game |
instead #84 (I ruined branch by rebase)