-
-
Notifications
You must be signed in to change notification settings - Fork 585
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
fix(traps): Fixed traps like the Poisonous Vine being triggered more than once #2464 #2466
fix(traps): Fixed traps like the Poisonous Vine being triggered more than once #2464 #2466
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
src/game.ts
Outdated
triggeredCreature.hexagons.forEach((hex) => { | ||
hex.activateTrap(this.triggers[trigger], triggeredCreature); | ||
}); | ||
const traps = getPointFacade().getTrapsAt(triggeredCreature); |
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.
Maybe @DreadKnight can chime in here.
From my point of view:
This will destroy all Trap
s under a Creature
as soon as one Trap
is activated. I don't think that's desired for all types of Trap
– "Poisonous Vine" is a bit of an outlier.
For now, I think this bug should probably be addressed locally in src/abilities/Impaler.js
in the "Poisonous Vine" ability.
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.
@andretchen0 I did some testing, with red player's Impaler having upgraded Poisonous Vine on two units and one eventually destroyed the trap, only the trap under it got destroyed, not for the other unit as well. Might do more testing though. Found a bug already, but not directly related to this.
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 should be addressed in src/abilities/Impaler.js
as well until we get that higher level fix.
Feel free to open that bigger issue yourself about trap sizes and even fix it when you can along with @2464 🐻 |
@JoelFernandes09 Heya! As @andretchen0 said, "I think this bug should probably be addressed locally in src/abilities/Impaler.js in the Poisonous Vine ability."; feel free to patch and mark this ready for review. |
Will do! @DreadKnight |
1856241
to
7562e75
Compare
@DreadKnight Fixed this by adding a bool check so the trap is placed once with the effect & the others are just placeholders with no effect. I'll open the bigger issue with traps as discussed above soon! |
@JoelFernandes09 Cool, will check it out soon! |
So I got to fixing it but its a bigger issue overall that I noticed with Traps. After debugging for a bit I found the issue to be in the
onStepOut
function of the game.Currently we're applying traps to all the hexes but we want them to be a single trap & not be called multiple times, so the broader solution to this is to maybe make traps occupy different number of hexes but being one entity. This will make it so that all trap related functions etc. will be executed once as intended but the trap will just take on as much space as the creature it was applied on.
For now I've made changes to the
triggerTrap
function & updated it to the Trap class since it was using a depreciated call as well as made it so the trap activates once but destroys all instances of the trap the creature is currently on. This fix should work temporarily but I feel the above change to traps is something to resolve the issue completely. If that's the case I would be happy to take it on once the issue is created for it. [Fixes #2464]